Exemple #1
0
 public function isRemote()
 {
     return $this->sourceReflection->getAdapterName() !== $this->targetReflection->getAdapterName();
 }
Exemple #2
0
 /**
  * Set property which is validation configured on
  *
  * @param string $name  Property name in entity
  * @param string $child Child property name
  *
  * @return \UniMapper\Validator
  *
  * @throws \Exception
  */
 public function on($name, $child = null)
 {
     $reflection = Entity\Reflection::load($this->entity);
     if (!$reflection->hasProperty($name)) {
         throw new Exception\InvalidArgumentException("Unknown property '" . $name . "'!");
     }
     $this->property = $reflection->getProperty($name);
     if ($this->property->hasOption(Entity\Reflection\Property::OPTION_COMPUTED)) {
         throw new Exception\InvalidArgumentException("Validation can not be used on computed property!");
     }
     if ($child && (!$this->property->getType() === Entity\Reflection\Property::TYPE_ENTITY && !$this->property->getType() === Entity\Reflection\Property::TYPE_COLLECTION)) {
         throw new Exception\InvalidArgumentException("Child validation can be used only on entities and collections!");
     }
     $this->child = $child;
     return $this->endCondition();
 }
Exemple #3
0
 /**
  * @param mixed $entity Entity object, class or name
  */
 public function __construct($entity)
 {
     $this->entityReflection = Entity\Reflection::load($entity);
 }