public function testChangeSet() { $object = new \stdClass(); $changeSets = new ChangeSets($object); $change = new Change('username', 'jonwage', 'jwage'); $changeSets->addObjectChange($object, $change); $changeSet = new ChangeSet($object, array('username' => $change)); $this->assertEquals($changeSet, $changeSets->getObjectChangeSet($object)); }
/** * Notifies this UnitOfWork of a property change in an object. * * @param object $object The entity that owns the property. * @param string $propertyName The name of the property that changed. * @param mixed $oldValue The old value of the property. * @param mixed $newValue The new value of the property. */ public function propertyChanged($object, $propertyName, $oldValue, $newValue) { if (!$this->isInIdentityMap($object)) { return; } if (!$this->isScheduledForUpdate($object)) { $this->update($object); } $this->objectChangeSets->addObjectChange($object, new Change($propertyName, $oldValue, $newValue)); }