public function __construct($type, $repository = null, array $index = null, array $info = array(), $data = array()) { if (!in_array($type, array(EntityCollection::DN, EntityCollection::SEARCH))) { throw new \InvalidArgumentException('Bad type of EntityCollection'); } $this->type = $type; if (is_string($repository)) { $this->classname = $repository; } else { $this->repository = $repository; $this->classname = $this->repository->getClassName(); } $this->info = $info; if ($type === EntityCollection::SEARCH) { throw new \Exception('Search not already implements'); if (!array_key_exists('searchQuery', $info)) { throw new \Exception('Type SEARCH but have no $info[\'searchQuery\']'); } $this->searchInfo = $info['searchQuery']; } $this->index = $index; $this->data = $data; // Case: ignore_errors => true, we search all results at the first query if (array_key_exists('ignore_errors', $this->info) && $this->info['ignore_errors'] === true) { $this->mustQueryBefore = true; } }
public function __construct($type, $repository = null, array $index = null, array $info = array(), $data = array()) { if (!in_array($type, array(EntityCollection::DN, EntityCollection::SEARCH))) { throw new \InvalidArgumentException('Bad type of EntityCollection'); } $this->type = $type; if (is_string($repository)) { $this->classname = $repository; } else { $this->repository = $repository; $this->classname = $this->repository->getClassName(); } $this->info = $info; if ($type === EntityCollection::SEARCH) { throw new \Exception('Search not already implements'); if (!array_key_exists('searchQuery', $info)) { throw new \Exception('Type SEARCH but have no $info[\'searchQuery\']'); } $this->searchInfo = $info['searchQuery']; } $this->index = $index; $this->data = $data; }