/** * Creates a new binding. * * @param string $query The resource query. * @param Resource|ResourceCollection $resources The resources to bind. * @param BindingType $type The type to bind against. * @param array $parameters Additional parameters. * @param string $language The language of the resource query. * * @throws NoSuchParameterException If an invalid parameter was passed. * @throws MissingParameterException If a required parameter was not passed. * @throws InvalidArgumentException If the resources are invalid. */ public function __construct($query, $resources, BindingType $type, array $parameters = array(), $language = 'glob') { if ($resources instanceof Resource) { $resources = new ArrayResourceCollection(array($resources)); } if (!$resources instanceof ResourceCollection) { throw new InvalidArgumentException(sprintf('Expected resources of type ResourceInterface or ' . 'ResourceCollectionInterface. Got: %s', is_object($resources) ? get_class($resources) : gettype($resources))); } Assert::greaterThan(count($resources), 0, 'You should pass at least one resource to EagerBinding.'); parent::__construct($query, $type, $parameters, $language); $this->resources = $resources; }
/** * {@inheritdoc} */ protected function postUnserialize(array &$data) { $this->className = array_pop($data); parent::postUnserialize($data); }
/** * {@inheritdoc} */ protected function postUnserialize(array &$data) { $this->language = array_pop($data); $this->query = array_pop($data); parent::postUnserialize($data); }
protected function postUnserialize(array &$data) { $this->string = array_pop($data); parent::postUnserialize($data); }
/** * Creates a new binding. * * @param string $query The resource query. * @param ResourceRepository $repo The repository to load the * resources from. * @param BindingType $type The type to bind against. * @param array $parameters Additional parameters. * @param string $language The language of the resource query. * * @throws NoSuchParameterException If an invalid parameter was passed. * @throws MissingParameterException If a required parameter was not passed. */ public function __construct($query, ResourceRepository $repo, BindingType $type, array $parameters = array(), $language = 'glob') { parent::__construct($query, $type, $parameters, $language); $this->repo = $repo; }