Exemple #1
0
 /**
  * Intercepts all reading property accesses and return corresponding Mockster instance
  *
  * @param string $name
  * @return Mockster
  * @throws \ReflectionException
  */
 public function __get($name)
 {
     if (!array_key_exists($name, $this->propertyMocksters)) {
         if (!$this->properties->has($name)) {
             throw new \ReflectionException("The property [{$this->class}::{$name}] does not exist");
         }
         if ($this->uuts) {
             $mockster = $this->properties[$name]->get($this->uuts[0])->__mockster;
         } else {
             $mockster = new Mockster($this->getTypeHint($name), $this->factory);
         }
         $this->propertyMocksters[$name] = $mockster;
     }
     return $this->propertyMocksters[$name];
 }
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Rewind the Iterator to the first element
  * @link http://php.net/manual/en/iterator.rewind.php
  * @return void Any returned value is ignored.
  */
 public function rewind()
 {
     $this->objIterator->rewind();
 }
Exemple #3
0
 public function selectProperties($names)
 {
     $this->properties = $this->properties->select(new Set($names));
     return $this;
 }
Exemple #4
0
 /**
  * Delete entity values.
  *
  * @throws \InvalidArgumentException
  */
 public function delete()
 {
     if (!in_array(SoftDeletes::class, class_uses_recursive(get_class($this->entity)), true) || $this->entity->forceDeleting) {
         $instance = new Value();
         $connection = $this->entity->getConnection();
         $connection->table($instance->getTable())->where('entity_id', $this->entity->getKey())->whereIn('property_id', $this->properties->pluck('id'))->delete();
     }
 }