Changeset 3054
- Timestamp:
- 07/11/2008 08:14:22 AM (4 months ago)
- Files:
-
- 1 copied
-
trunk/system/libraries/ORM.php (copied) (copied from trunk/system/libraries/ORM2.php) (9 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/ORM.php
r3052 r3054 1 1 <?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 */ 16 class ORM_Core { 4 17 5 18 // Current relationships … … 221 234 222 235 // Load model 223 $model = ORM 2::factory($model);236 $model = ORM::factory($model); 224 237 225 238 if (isset($this->object[$column.'_'.$model->primary_key])) … … 239 252 elseif (in_array($column, $this->has_one) OR in_array($column, $this->belongs_to)) 240 253 { 241 $model = ORM 2::factory($column);254 $model = ORM::factory($column); 242 255 243 256 if (isset($this->object[$column.'_'.$model->primary_key])) … … 253 266 254 267 // one<>one relationship 255 return $this->object[$column] = ORM 2::factory($column, $where);268 return $this->object[$column] = ORM::factory($column, $where); 256 269 } 257 270 elseif (isset($this->has_many[$column])) 258 271 { 259 272 // Load the "middle" model 260 $through = ORM 2::factory(inflector::singular($this->has_many[$column]));273 $through = ORM::factory(inflector::singular($this->has_many[$column])); 261 274 262 275 // Load the "end" model 263 $model = ORM 2::factory(inflector::singular($column));276 $model = ORM::factory(inflector::singular($column)); 264 277 265 278 // Load JOIN info … … 277 290 { 278 291 // one<>many relationship 279 return $this->object[$column] = ORM 2::factory(inflector::singular($column))292 return $this->object[$column] = ORM::factory(inflector::singular($column)) 280 293 ->where($this->foreign_key($column), $this->object[$this->primary_key]) 281 294 ->find_all(); … … 284 297 { 285 298 // Load the remote model, always singular 286 $model = ORM 2::factory(inflector::singular($column));299 $model = ORM::factory(inflector::singular($column)); 287 300 288 301 // Load JOIN info … … 565 578 566 579 // Load the model 567 $model = ORM 2::factory($object);580 $model = ORM::factory($object); 568 581 569 582 if (is_int($join_table)) … … 601 614 602 615 // Load the model 603 $model = ORM 2::factory($object);616 $model = ORM::factory($object); 604 617 605 618 // Load JOIN table … … 632 645 633 646 // Load the model 634 $model = ORM 2::factory($object);647 $model = ORM::factory($object); 635 648 636 649 // Load JOIN table
