示例#1
0
文件: Model.php 项目: titon/model
 /**
  * When data is mapped through the constructor, set the exists flag if necessary,
  * and save the original data state to monitor for changes.
  *
  * @param array $data
  * @return $this
  */
 public function mapData(array $data)
 {
     $this->flush();
     if (!empty($data[$this->primaryKey])) {
         $this->_exists = true;
     }
     $this->_original = Hash::exclude($data, $this->reserved);
     $this->_attributes = $data;
     return $this;
 }
示例#2
0
 function array_exclude(array $set, array $keys)
 {
     return Hash::exclude($set, $keys);
 }
示例#3
0
 /**
  * Test that exclude() will remove certain keys.
  */
 public function testExclude()
 {
     $this->assertEquals(array('foo' => 123), Hash::exclude(array('foo' => 123, 'bar' => 456, 'baz' => 789), array('bar', 'baz')));
 }