Changeset 1053
- Timestamp:
- 11/20/07 17:46:25 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/rdbms/persistence/stubEntityManager.php
r1052 r1053 1 1 <?php 2 2 /** 3 * Entity manager to hide the classes that do the real work.3 * Interface for an entity manager to hide the classes that do the real work. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 15 15 ); 16 16 /** 17 * Entity manager to hide the classes that do the real work.17 * Interface for an entity manager to hide the classes that do the real work. 18 18 * 19 19 * @package stubbles 20 20 * @subpackage rdbms_persistence 21 * @ImplementedBy(net.stubbles.rdbms.persistence.stubDefaultEntityManager.class) 21 22 */ 22 class stubEntityManager extends stubBaseObject23 interface stubEntityManager extends stubObject 23 24 { 24 /**25 * connection instance to use26 *27 * @var stubDatabaseConnection28 */29 protected $connection;30 31 /**32 * constructor33 *34 * @param stubDatabaseConnection $connection35 */36 public function __construct(stubDatabaseConnection $connection)37 {38 $this->connection = $connection;39 }40 41 25 /** 42 26 * get an entity from database by its primary keys … … 49 33 * @throws stubPersistenceException 50 34 */ 51 public function findByPrimaryKey(stubBaseReflectionClass $entityClass, array $primaryKeys, array $arguments = null) 52 { 53 return stubDatabaseFinder::getInstance($this->connection) 54 ->findByPrimaryKeys($entityClass, $primaryKeys, $arguments); 55 } 35 public function findByPrimaryKey(stubBaseReflectionClass $entityClass, array $primaryKeys, array $arguments = null); 56 36 57 37 /** … … 65 45 * @throws stubPersistenceException 66 46 */ 67 public function findByCriterion(stubCriterion $criterion, stubBaseReflectionClass $entityClass, array $arguments = null) 68 { 69 return stubDatabaseFinder::getInstance($this->connection) 70 ->findByCriterion($criterion, $entityClass, $arguments); 71 } 47 public function findByCriterion(stubCriterion $criterion, stubBaseReflectionClass $entityClass, array $arguments = null); 72 48 73 49 /** … … 79 55 * @throws stubPersistenceException 80 56 */ 81 public function serialize($entity) 82 { 83 return stubDatabaseSerializer::getInstance($this->connection) 84 ->serialize($entity); 85 } 57 public function serialize($entity); 86 58 87 59 /** … … 92 64 * @throws stubPersistenceException 93 65 */ 94 public function deleteByPrimaryKeys($entity) 95 { 96 stubDatabaseEraser::getInstance($this->connection) 97 ->deleteByPrimaryKeys($entity); 98 } 66 public function deleteByPrimaryKeys($entity); 99 67 100 68 /** … … 106 74 * @throws stubDatabaseEraserException 107 75 */ 108 public function deleteByCriterion(stubCriterion $criterion, stubBaseReflectionClass $entityClass) 109 { 110 return stubDatabaseEraser::getInstance($this->connection) 111 ->deleteByCriterion($criterion, $entityClass); 112 } 76 public function deleteByCriterion(stubCriterion $criterion, stubBaseReflectionClass $entityClass); 113 77 } 114 78 ?>
