Changeset 3054

Show
Ignore:
Timestamp:
07/11/2008 08:14:22 AM (4 months ago)
Author:
Shadowhand
Message:

Moved ORM2 to ORM.

Files:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/ORM.php

    r3052 r3054  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    2  
    3 class ORM2_Core { 
     2/** 
     3 * Object Relational Mapping (ORM) is a method of abstracting database 
     4 * access to standard PHP calls. All table rows are represented as a model. 
     5 * 
     6 * @see http://en.wikipedia.org/wiki/Active_record 
     7 * @see http://en.wikipedia.org/wiki/Object-relational_mapping 
     8 * 
     9 * $Id: ORM.php 2975 2008-07-07 00:20:45Z Shadowhand $ 
     10 * 
     11 * @package    Core 
     12 * @author     Kohana Team 
     13 * @copyright  (c) 2007-2008 Kohana Team 
     14 * @license    http://kohanaphp.com/license.html 
     15 */ 
     16class ORM_Core { 
    417 
    518        // Current relationships 
     
    221234 
    222235                        // Load model 
    223                         $model = ORM2::factory($model); 
     236                        $model = ORM::factory($model); 
    224237 
    225238                        if (isset($this->object[$column.'_'.$model->primary_key])) 
     
    239252                elseif (in_array($column, $this->has_one) OR in_array($column, $this->belongs_to)) 
    240253                { 
    241                         $model = ORM2::factory($column); 
     254                        $model = ORM::factory($column); 
    242255 
    243256                        if (isset($this->object[$column.'_'.$model->primary_key])) 
     
    253266 
    254267                        // one<>one relationship 
    255                         return $this->object[$column] = ORM2::factory($column, $where); 
     268                        return $this->object[$column] = ORM::factory($column, $where); 
    256269                } 
    257270                elseif (isset($this->has_many[$column])) 
    258271                { 
    259272                        // Load the "middle" model 
    260                         $through = ORM2::factory(inflector::singular($this->has_many[$column])); 
     273                        $through = ORM::factory(inflector::singular($this->has_many[$column])); 
    261274 
    262275                        // Load the "end" model 
    263                         $model = ORM2::factory(inflector::singular($column)); 
     276                        $model = ORM::factory(inflector::singular($column)); 
    264277 
    265278                        // Load JOIN info 
     
    277290                { 
    278291                        // one<>many relationship 
    279                         return $this->object[$column] = ORM2::factory(inflector::singular($column)) 
     292                        return $this->object[$column] = ORM::factory(inflector::singular($column)) 
    280293                                ->where($this->foreign_key($column), $this->object[$this->primary_key]) 
    281294                                ->find_all(); 
     
    284297                { 
    285298                        // Load the remote model, always singular 
    286                         $model = ORM2::factory(inflector::singular($column)); 
     299                        $model = ORM::factory(inflector::singular($column)); 
    287300 
    288301                        // Load JOIN info 
     
    565578 
    566579                // Load the model 
    567                 $model = ORM2::factory($object); 
     580                $model = ORM::factory($object); 
    568581 
    569582                if (is_int($join_table)) 
     
    601614 
    602615                // Load the model 
    603                 $model = ORM2::factory($object); 
     616                $model = ORM::factory($object); 
    604617 
    605618                // Load JOIN table 
     
    632645 
    633646                // Load the model 
    634                 $model = ORM2::factory($object); 
     647                $model = ORM::factory($object); 
    635648 
    636649                // Load JOIN table