Changeset 6fd857 for OWR/Model.php


Ignore:
Timestamp:
07/10/10 14:23:07 (9 years ago)
Author:
pierre-alain <pierre-alain@…>
Branches:
master
Children:
91feee
Parents:
b65617
git-author:
pierre-alain <pierre-alain@…> (07/10/10 14:23:07)
git-committer:
pierre-alain <pierre-alain@…> (07/10/10 14:23:07)
Message:

conventions renaming

File:
1 moved

Legend:

Unmodified
Added
Removed
  • OWR/Model.php

    rb65617 r6fd857  
    11<?php 
    22/** 
    3  * Logic Object base class 
     3 * Model Object base class 
    44 * 
    55 * PHP 5 
     
    3535 */ 
    3636namespace OWR; 
    37 use OWR\Interfaces\Logic as iLogic, 
     37use OWR\Interfaces\Model as iModel, 
    3838    OWR\User; 
    3939/** 
     
    4242 * 
    4343 * @abstract 
    44  * @uses OWR\Interfaces\Logic implements the Logic interface 
     44 * @uses OWR\Interfaces\Model implements the Model interface 
    4545 * @uses OWR\DB the database link 
    4646 * @uses OWR\Request a request sent to the database 
     
    5050 * @package OWR 
    5151 */ 
    52 abstract class Logic implements iLogic 
     52abstract class Model implements iModel 
    5353{ 
    5454    /** 
     
    7777 
    7878    /** 
    79     * @var array stored already processed logic names 
     79    * @var array stored already processed model names 
    8080    * @access private 
    8181    * @static 
    8282    */ 
    83     static private $_logics = array(); 
     83    static private $_models = array(); 
    8484 
    8585    /** 
    86     * @var array stored already processed logics objects 
     86    * @var array stored already processed models objects 
    8787    * @access private 
    8888    * @static 
    8989    */ 
    90     static private $_cachedLogics = array(); 
     90    static private $_cachedModels = array(); 
    9191 
    9292    /** 
     
    100100        $this->_db = DB::iGet(); // we assume here that the connexion has already been done, be carefull 
    101101        $this->_fullName = get_called_class(); 
    102         $this->_name = str_replace('\\', '_', substr($this->_fullName, strlen(__NAMESPACE__.'_Logic_'))); 
     102        $this->_name = str_replace('\\', '_', substr($this->_fullName, strlen(__NAMESPACE__.'_Model_'))); 
    103103        $this->_dao = DAO::getDAO($this->_name); 
    104104    } 
    105105 
    106106    /** 
    107      * Returns the specified Logic object 
     107     * Returns the specified Model object 
    108108     * 
    109109     * @access public 
    110110     * @static 
    111111     * @author Pierre-Alain Mignot <contact@openwebreader.org> 
    112      * @param string $logic the name of the Logic 
    113      * @return mixed the Logic object 
     112     * @param string $model the name of the Model 
     113     * @return mixed the Model object 
    114114     */ 
    115     static public function getLogic($logic) 
     115    static public function getModel($model) 
    116116    { 
    117         if(!isset(self::$_logics[$logic])) 
     117        if(!isset(self::$_models[$model])) 
    118118        { 
    119             $c = __NAMESPACE__.'\Logic\\'.join('\\', array_map('ucfirst', explode('_', (string) $logic)));; 
    120             self::$_logics[$logic] = $c; 
     119            $c = __NAMESPACE__.'\Model\\'.join('\\', array_map('ucfirst', explode('_', (string) $model)));; 
     120            self::$_models[$model] = $c; 
    121121        } 
    122         return new self::$_logics[$logic]; 
     122        return new self::$_models[$model]; 
    123123    } 
    124124 
    125125    /** 
    126      * Returns the specified Logic object from cache 
     126     * Returns the specified Model object from cache 
    127127     * 
    128128     * @access public 
    129129     * @static 
    130130     * @author Pierre-Alain Mignot <contact@openwebreader.org> 
    131      * @param string $logic the name of the Logic 
    132      * @return mixed the Logic object 
     131     * @param string $model the name of the Model 
     132     * @return mixed the Model object 
    133133     */ 
    134     static public function getCachedLogic($logic) 
     134    static public function getCachedModel($model) 
    135135    { 
    136         $logic = ucfirst((string) $logic); 
    137         isset(self::$_cachedLogics[$logic]) || (self::$_cachedLogics[$logic] = self::getLogic($logic)); 
     136        $model = ucfirst((string) $model); 
     137        isset(self::$_cachedModels[$model]) || (self::$_cachedModels[$model] = self::getModel($model)); 
    138138 
    139         return self::$_cachedLogics[$logic]; 
     139        return self::$_cachedModels[$model]; 
    140140    } 
    141141} 
Note: See TracChangeset for help on using the changeset viewer.