From 7eeb6b5a658f47b35aa99b1da80bfd5aed7e94d4 Mon Sep 17 00:00:00 2001 From: carl <> Date: Mon, 13 Oct 2008 11:15:28 +0000 Subject: LIMIT 1 for ActiveRecord find() and findBy() --- framework/Data/ActiveRecord/TActiveRecord.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'framework') diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 1afbb043..4e6fd134 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -552,6 +552,7 @@ abstract class TActiveRecord extends TComponent { $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; $criteria = $this->getRecordCriteria($criteria,$parameters, $args); + $criteria->setLimit(1); $data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria); return $this->populateObject($data); } @@ -629,6 +630,7 @@ abstract class TActiveRecord extends TComponent { $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; $criteria = $this->getRecordCriteria($sql,$parameters, $args); + $criteria->setLimit(1); $data = $this->getRecordGateway()->findRecordBySql($this,$criteria); return $this->populateObject($data); } -- cgit v1.2.3