| 1 |
|
<?php |
| 2 |
|
/** |
| 3 |
|
* Xyster Framework |
| 4 |
|
* |
| 5 |
|
* This source file is subject to the new BSD license that is bundled |
| 6 |
|
* with this package in the file LICENSE.txt. |
| 7 |
|
* It is also available through the world-wide-web at this URL: |
| 8 |
|
* http://www.opensource.org/licenses/bsd-license.php |
| 9 |
|
* |
| 10 |
|
* @category Xyster |
| 11 |
|
* @package Xyster_Orm |
| 12 |
|
* @copyright Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net) |
| 13 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 14 |
|
* @version $Id: Abstract.php 202 2008-01-20 16:20:09Z doublecompile $ |
| 15 |
|
*/ |
| 16 |
|
/** |
| 17 |
|
* @see Xyster_Orm_Mapper_Factory_Interface |
| 18 |
|
*/ |
| 19 |
1 |
require_once 'Xyster/Orm/Mapper/Factory/Interface.php'; |
| 20 |
|
/** |
| 21 |
|
* A simple factory for creating mappers |
| 22 |
|
* |
| 23 |
|
* @category Xyster |
| 24 |
|
* @package Xyster_Orm |
| 25 |
|
* @copyright Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net) |
| 26 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 27 |
|
*/ |
| 28 |
|
abstract class Xyster_Orm_Mapper_Factory_Abstract implements Xyster_Orm_Mapper_Factory_Interface |
| 29 |
|
{ |
| 30 |
|
/** |
| 31 |
|
* The manager containing this factory |
| 32 |
|
* |
| 33 |
|
* @var Xyster_Orm_Manager |
| 34 |
|
*/ |
| 35 |
|
protected $_manager; |
| 36 |
|
|
| 37 |
|
/** |
| 38 |
|
* A place to cache instantiated mappers |
| 39 |
|
* |
| 40 |
|
* @var array |
| 41 |
|
*/ |
| 42 |
|
protected $_mappers = array(); |
| 43 |
|
|
| 44 |
|
/** |
| 45 |
|
* Gets the entity meta for a given class |
| 46 |
|
* |
| 47 |
|
* @param string $className The name of the entity class |
| 48 |
|
* @return Xyster_Orm_Entity_Meta The meta object |
| 49 |
|
*/ |
| 50 |
|
public function getEntityMeta( $className ) |
| 51 |
|
{ |
| 52 |
113 |
return $this->get($className)->getEntityMeta(); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
/** |
| 56 |
|
* Gets the manager containing this factory |
| 57 |
|
* |
| 58 |
|
* @return Xyster_Orm_Manager |
| 59 |
|
*/ |
| 60 |
|
public function getManager() |
| 61 |
|
{ |
| 62 |
160 |
return $this->_manager; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
/** |
| 66 |
|
* Sets the manager that contains this factory |
| 67 |
|
* |
| 68 |
|
* @param Xyster_Orm_Manager $manager |
| 69 |
|
*/ |
| 70 |
|
public function setManager( Xyster_Orm_Manager $manager ) |
| 71 |
|
{ |
| 72 |
284 |
$this->_manager = $manager; |
| 73 |
|
} |
| 74 |
|
} |