Changeset 1893

Show
Ignore:
Timestamp:
01/31/2008 03:38:02 PM (11 months ago)
Author:
Shadowhand
Message:

Quick fixes:

  • Set properties on config/email, and helpers/email
  • Added child<>parent one<>one transparency to ORM
Location:
trunk/system
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/config/email.php

    • Property svn:eol-style set to LF
    • Property copyright set to Copyright (c) 2008 Kohana Team
    • Property svn:keywords set to Id
  • trunk/system/helpers/email.php

    • Property svn:eol-style set to LF
    • Property copyright set to Copyright (c) 2008 Kohana Team
    • Property svn:keywords set to Id
    r1892 r1893  
    33 * Email helper class. 
    44 * 
    5  * $Id: valid.php 1865 2008-01-29 19:48:29Z Geert $ 
     5 * $Id$ 
    66 * 
    77 * @package    Validation 
  • trunk/system/libraries/ORM.php

    r1877 r1893  
    133133                        return $this->object->$key; 
    134134                } 
    135                 elseif ( ! empty($this->object->id) AND in_array($key, $this->has_one)) 
     135                elseif ( ! empty($this->object->id) AND (in_array($key, $this->has_one) OR in_array($key, $this->belongs_to))) 
    136136                { 
    137137                        // Set the model name 
    138138                        $model = ucfirst($key).'_Model'; 
    139139 
    140                         // Set the foreign key name 
    141                         $id = $key.'_id'; 
    142  
    143                         if (isset($this->object->$id)) 
    144                         { 
    145                                 return $this->object->$key = new $model($this->object->$id); 
     140                        // Set the child id name 
     141                        $child_id = $key.'_id'; 
     142 
     143                        if (isset($this->object->$child_id)) 
     144                        { 
     145                                // Get the foreign object using the key defined in this object 
     146                                return $this->object->$key = new $model($this->object->$child_id); 
    146147                        } 
    147148                        else 
    148149                        { 
    149                                 // Set the foriegn key to this primary key 
    150                                 $id = $this->class.'_id'; 
    151  
     150                                // Get the foreign object using the primary key of this object 
    152151                                return $this->object->$key = new $model(array($this->class.'_id', $this->object->id)); 
    153152                        }