toCollection() public method

Transforms value from mapper, which is not a collection.
public toCollection ( $data ) : Nextras\Orm\Collection\ICollection
return Nextras\Orm\Collection\ICollection
Beispiel #1
0
 public function __call($method, $args)
 {
     if (isset($this->proxyMethods[strtolower($method)])) {
         $result = call_user_func_array([$this->mapper, $method], $args);
         if (!($result instanceof ICollection || $result instanceof IEntity || $result === null)) {
             $result = $this->mapper->toCollection($result);
         }
         return $result;
     } else {
         return parent::__call($method, $args);
     }
 }
Beispiel #2
0
 public function __call($method, $args)
 {
     if (isset($this->proxyMethods[strtolower($method)])) {
         if (substr($method, 0, 5) === 'getBy' || substr($method, 0, 6) === 'findBy') {
             return call_user_func_array([$this->findAll(), $method], $args);
         }
         $result = call_user_func_array([$this->mapper, $method], $args);
         if (!($result instanceof ICollection || $result instanceof IEntity)) {
             $result = $this->mapper->toCollection($result);
         }
         return $result;
     } else {
         return parent::__call($method, $args);
     }
 }