root

Changeset 723

Show
Ignore:
Timestamp:
10/26/09 12:48:25 (9 months ago)
Author:
wbond
Message:

Fixed ticket #323 - fActiveRecord objects now return the object from associate, link and populate methods to allow for method chaining

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fActiveRecord.php

    r720 r723 Hide Line Numbers
    1616 * @link       http://flourishlib.com/fActiveRecord 
    1717 *  
    18  * @version    1.0.0b46 
     18 * @version    1.0.0b47 
     19 * @changes    1.0.0b47  Changed `::associate{RelatedRecords}()`, `::link{RelatedRecords}()` and `::populate{RelatedRecords}()` to allow for method chaining [wb, 2009-10-22] 
    1920 * @changes    1.0.0b46  Changed SQL statements to use value placeholders and identifier escaping [wb, 2009-10-22] 
    2021 * @changes    1.0.0b45  Added support for `!~`, `&~`, `><` and OR comparisons to ::checkConditions(), made object handling in ::checkConditions() more robust [wb, 2009-09-21] 
     
    788789                // This handles one-to-many and many-to-many relationships 
    789790                if ($plural) { 
    790                     return fORMRelated::associateRecords($class, $this->related_records, $subject, $records, $route); 
    791                 } 
     791                    fORMRelated::associateRecords($class, $this->related_records, $subject, $records, $route); 
    792792                 
    793793                // This handles one-to-one relationships 
    794                 return fORMRelated::associateRecord($class, $this->related_records, $subject, $records, $route); 
     794                } else { 
     795                    fORMRelated::associateRecord($class, $this->related_records, $subject, $records, $route); 
     796                } 
     797                return $this; 
    795798             
    796799            case 'build': 
     
    841844                 
    842845                if (isset($parameters[0])) { 
    843                     return fORMRelated::linkRecords($class, $this->related_records, $subject, $parameters[0]); 
    844                 } 
    845                 return fORMRelated::linkRecords($class, $this->related_records, $subject); 
     846                    fORMRelated::linkRecords($class, $this->related_records, $subject, $parameters[0]); 
     847                } else { 
     848                    fORMRelated::linkRecords($class, $this->related_records, $subject); 
     849                } 
     850                return $this; 
    846851             
    847852            case 'list': 
     
    874879                $subject = fGrammar::camelize($subject, TRUE); 
    875880                 
    876                 return fORMRelated::populateRecords($class, $this->related_records, $subject, $route); 
     881                fORMRelated::populateRecords($class, $this->related_records, $subject, $route); 
     882                return $this; 
    877883             
    878884            case 'tally':