public function getQueryForRepository(Repository $repository) { $columns = $repository->getAnalyzer()->listColumns(); if (!array_key_exists($this->key, $columns)) { throw new \InvalidArgumentException('No column name ' . $this->key . '. Column available : [' . implode(',', array_keys($columns)) . ']'); } return ($this->not ? '!' : '') . '(' . $this->key . self::$operator[$this->conditionOperator] . $this->value . ')'; }
public function get($key) { if (!array_key_exists($key, $this->index)) { throw new \OutOfBoundsException($key); } if (!array_key_exists($key, $this->data)) { $this->data[$key] = $this->repository->read($this->index[$key]); } return $this->data[$key]; }
public function testRepositoryQuery() { $query = new Query(Query::CAND); $query->cOr([new Condition('telephoneNumber', '03 00 00 00 01'), new Condition('telephoneNumber', '03 00 00 00 00')]); $uids = []; $result = $this->repository->findByQuery($query); foreach ($result as $r) { $uids[] = $r->getUid(); } $this->assertEquals(2, count($uids)); $this->assertContains('pdeparis', $uids); $this->assertContains('mdupont', $uids); }
public function get($key) { $this->checkMustQueryBefore(); if (!array_key_exists($key, $this->index)) { throw new \OutOfBoundsException($key); } if (!array_key_exists($key, $this->data)) { $this->data[$key] = $this->repository->read($this->index[$key]); } if ($this->data[$key] === false) { throw new BadRelationException('Not found entry: ' . $this->index[$key]); } return $this->data[$key]; }