Пример #1
0
 /**
  * @param \Kalnoy\Cruddy\Entity $entity
  * @param \Kalnoy\Cruddy\Schema\BaseCollection $collection
  * @param $id
  * @param null $fieldId
  *
  * @return Types\Proxy
  */
 public function usingField($entity, $collection, $id, $fieldId = null)
 {
     $field = $this->resolveField($entity, $fieldId ?: $id);
     $instance = new Types\Proxy($entity, $id, $field);
     $collection->add($instance);
     return $instance;
 }
Пример #2
0
 /**
  * Evaluate callback.
  *
  * @param mixed $callback
  * @param BaseCollection $collection
  * @param array $params
  *
  * @return Entry
  */
 protected function evaluate($callback, BaseCollection $collection, array $params)
 {
     $entity = $collection->getEntity();
     array_unshift($params, $entity, $collection);
     return call_user_func_array($callback, $params);
 }