Ejemplo n.º 1
0
 public function __construct(Reflection $entityReflection, $primaryValue, array $data)
 {
     parent::__construct($entityReflection);
     $this->primaryValue = $primaryValue;
     // Primary value update is not allowed
     if (!$entityReflection->hasPrimary()) {
         throw new Exception\QueryException("Entity '" . $entityReflection->getClassName() . "' has no " . "primary property!");
     }
     // Do not change primary value
     unset($data[$entityReflection->getPrimaryProperty()->getName()]);
     $this->entity = $entityReflection->createEntity($data);
 }
Ejemplo n.º 2
0
 public function __construct(Reflection $entityReflection, $primaryValue)
 {
     parent::__construct($entityReflection);
     if (!$entityReflection->hasPrimary()) {
         throw new Exception\QueryException("Can not use deleteOne() on entity without primary property!");
     }
     if (empty($primaryValue)) {
         throw new Exception\QueryException("Primary value can not be empty!");
     }
     try {
         $entityReflection->getPrimaryProperty()->validateValueType($primaryValue);
     } catch (Exception\InvalidArgumentException $e) {
         throw new Exception\QueryException($e->getMessage());
     }
     $this->primaryValue = $primaryValue;
 }
Ejemplo n.º 3
0
 public function __construct(Reflection $entityReflection, $primaryValue)
 {
     parent::__construct($entityReflection);
     // Primary
     if (!$entityReflection->hasPrimary()) {
         throw new Exception\QueryException("Can not use query on entity without primary property!");
     }
     try {
         $entityReflection->getPrimaryProperty()->validateValueType($primaryValue);
     } catch (Exception\InvalidArgumentException $e) {
         throw new Exception\QueryException($e->getMessage());
     }
     $this->primaryValue = $primaryValue;
     // Selection
     $this->select(array_slice(func_get_args(), 3));
 }
Ejemplo n.º 4
0
 public function __construct(Reflection $entityReflection, array $data)
 {
     parent::__construct($entityReflection);
     $this->entity = $entityReflection->createEntity($data);
 }
Ejemplo n.º 5
0
 public function __construct(Reflection $entityReflection)
 {
     parent::__construct($entityReflection);
     $this->select(array_slice(func_get_args(), 3));
 }