PHP on T R A X
Rapid Application Development Made Easy

Changeset 293

Show
Ignore:
Timestamp:
12/08/07 10:52:36 (7 months ago)
Author:
john
Message:

unset association if belongs_to or has_one returns null so it can be call via set()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/trax/vendor/trax/active_record.php

    r283 r293  
    505505                    $parameters = is_array($this->has_one) ? $this->has_one[$key] : null; 
    506506                    $this->$key = $this->find_one_has_one($key, $parameters); 
     507                                        if(is_null($this->$key)) unset($this->$key);                                     
    507508                    break; 
    508509                case "belongs_to": 
    509510                    $parameters = is_array($this->belongs_to) ? $this->belongs_to[$key] : null; 
    510511                    $this->$key = $this->find_one_belongs_to($key, $parameters); 
     512                                        if(is_null($this->$key)) unset($this->$key);                                     
    511513                    break; 
    512514                case "has_and_belongs_to_many":