[Solar-svn] Revision 3014

pmjones at solarphp.com pmjones at solarphp.com
Mon Mar 17 21:40:22 CDT 2008


Solar_Sql_Model: [ADD] __call() method now supports 'fetchBy' as an alias of 'fetchOneBy'.


Modified: trunk/Solar/Sql/Model.php
===================================================================
--- trunk/Solar/Sql/Model.php	2008-03-18 02:39:29 UTC (rev 3013)
+++ trunk/Solar/Sql/Model.php	2008-03-18 02:40:16 UTC (rev 3014)
@@ -586,11 +586,17 @@
      */
     public function __call($method, $params)
     {
-        // is it "fetchOneBy" or "fetchAllBy"?
-        if (substr($method, 0, 10) == 'fetchOneBy') {
+        // fetch a record, or a collection?
+        if (substr($method, 0, 7) == 'fetchBy') {
+            // fetch a record
             $fetch = 'fetchOne';
+            $method = substr($method, 7);
+        } elseif (substr($method, 0, 10) == 'fetchOneBy') {
+            // fetch a record
+            $fetch = 'fetchOne';
             $method = substr($method, 10);
         } elseif (substr($method, 0, 10) == 'fetchAllBy') {
+            // fetch a collection
             $fetch = 'fetchAll';
             $method = substr($method, 10);
         } else {




More information about the Solar-svn mailing list