예제 #1
0
 /**
  * @param $target
  * @param $source
  * @param $propertyName
  * @throws InvalidArgumentException
  * @throws NotExistingPropertyException
  */
 public function cloneProperty($target, $source, $propertyName)
 {
     $this->validaObjects($target, $source);
     $reflection = new \ReflectionClass($target);
     if (!$reflection->hasProperty($propertyName)) {
         throw new NotExistingPropertyException();
     }
     $this->propertyAccessor->setValue($target, $propertyName, $this->propertyAccessor->getValue($source, $propertyName));
 }
 /**
  * @param NewCommand $command
  */
 public function handle(NewCommand $command)
 {
     $this->persistedEntities[] = $command->getEntity();
     //After persisting entity we need to give it some unique identity
     $this->propertyAccessor->setValue($command->getEntity(), "id", time());
 }
 /**
  * @param mixed $defaultValue
  * @param mixed $newValue
  * @param mixed $targetObject
  */
 public function execute($defaultValue, $newValue, $targetObject)
 {
     $newValueSnapshot = $this->snapshotMaker->makeSnapshotOf($newValue);
     $this->propertyAccessor->setValue($this->snapshot, (string) $this->lazyProperty->getName(), $newValueSnapshot);
 }