Changeset 1053

Show
Ignore:
Timestamp:
11/20/07 17:46:25 (1 year ago)
Author:
mikey
Message:

made stubEntityManager an interface, moved implementation to stubDefaultEntityManager

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/rdbms/persistence/stubEntityManager.php

    r1052 r1053  
    11<?php 
    22/** 
    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. 
    44 * 
    55 * @author      Frank Kleine <mikey@stubbles.net> 
     
    1515); 
    1616/** 
    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. 
    1818 * 
    1919 * @package     stubbles 
    2020 * @subpackage  rdbms_persistence 
     21 * @ImplementedBy(net.stubbles.rdbms.persistence.stubDefaultEntityManager.class) 
    2122 */ 
    22 class stubEntityManager extends stubBaseObject 
     23interface stubEntityManager extends stubObject 
    2324{ 
    24     /** 
    25      * connection instance to use 
    26      * 
    27      * @var  stubDatabaseConnection 
    28      */ 
    29     protected $connection; 
    30  
    31     /** 
    32      * constructor 
    33      * 
    34      * @param  stubDatabaseConnection  $connection 
    35      */ 
    36     public function __construct(stubDatabaseConnection $connection) 
    37     { 
    38         $this->connection = $connection; 
    39     } 
    40  
    4125    /** 
    4226     * get an entity from database by its primary keys 
     
    4933     * @throws  stubPersistenceException 
    5034     */ 
    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); 
    5636 
    5737    /** 
     
    6545     * @throws  stubPersistenceException 
    6646     */ 
    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); 
    7248 
    7349    /** 
     
    7955     * @throws  stubPersistenceException 
    8056     */ 
    81     public function serialize($entity) 
    82     { 
    83         return stubDatabaseSerializer::getInstance($this->connection) 
    84                                      ->serialize($entity); 
    85     } 
     57    public function serialize($entity); 
    8658 
    8759    /** 
     
    9264     * @throws  stubPersistenceException 
    9365     */ 
    94     public function deleteByPrimaryKeys($entity) 
    95     { 
    96         stubDatabaseEraser::getInstance($this->connection) 
    97                           ->deleteByPrimaryKeys($entity); 
    98     } 
     66    public function deleteByPrimaryKeys($entity); 
    9967 
    10068    /** 
     
    10674     * @throws  stubDatabaseEraserException 
    10775     */ 
    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); 
    11377} 
    11478?>