Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions lib/HireVoice/Neo4j/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
namespace HireVoice\Neo4j;
use Doctrine\Common\Collections\ArrayCollection;
use HireVoice\Neo4j\Query\LuceneQueryProcessor;
use Doctrine\Common\Persistence\ObjectRepository;

class Repository
class Repository implements ObjectRepository
{
/**
* @var \HireVoice\Neo4j\Meta\Entity
Expand Down Expand Up @@ -96,6 +97,7 @@ function getIndex()
* Finds one node by a set of criteria
*
* @param array $criteria An array of search criteria
* @return null|object
*/
public function findOneBy(array $criteria)
{
Expand All @@ -111,9 +113,17 @@ public function findOneBy(array $criteria)
* Finds all node matching the search criteria
*
* @param array $criteria An array of search criteria
* @param array $orderBy
* @param null $limit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please annotate int|null type.

* @param null $offset
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function findBy(array $criteria)
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception if I use a common API method?

{
if ($orderBy !== null || $limit !== null || $offset !== null) {
throw new \InvalidArgumentException('$orderBy, $limit and $offset are currently not supported');
}

$query = $this->createQuery($criteria);
$collection = new ArrayCollection();

Expand Down Expand Up @@ -199,4 +209,14 @@ public function getMeta()
{
return $this->meta;
}

/**
* Returns the class name of the object managed by the repository.
*
* @return string
*/
public function getClassName()
{
return $this->class;
}
}