/** * 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; }
function array_exclude(array $set, array $keys) { return Hash::exclude($set, $keys); }
/** * 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'))); }