1
0
mirror of synced 2025-01-18 06:21:40 +03:00

findByXXX/findOneByXXX does now also accept orderBy, limit and offset args

Conflicts:

	lib/Doctrine/ORM/EntityRepository.php
This commit is contained in:
Martin Pöhlmann 2011-09-02 15:53:52 +02:00 committed by Alexander
parent 79d9c07652
commit 39ad87650e

View File

@ -225,7 +225,16 @@ class EntityRepository implements ObjectRepository
$fieldName = lcfirst(\Doctrine\Common\Util\Inflector::classify($by));
if ($this->_class->hasField($fieldName) || $this->_class->hasAssociation($fieldName)) {
return $this->$method(array($fieldName => $arguments[0]));
$argumentSize = sizeof($arguments);
if ($argumentSize == 1) {
return $this->$method(array($fieldName => $arguments[0]));
} else if ($argumentSize == 2) {
return $this->$method(array($fieldName => $arguments[0]), $arguments[1]);
} else if ($argumentSize == 3) {
return $this->$method(array($fieldName => $arguments[0]), $arguments[1], $arguments[2]);
} else if ($argumentSize == 4) {
return $this->$method(array($fieldName => $arguments[0]), $arguments[1], $arguments[2], $arguments[3]);
}
}
throw ORMException::invalidFindByCall($this->_entityName, $fieldName, $method.$by);