Changeset 5979


Ignore:
Timestamp:
01/25/12 05:43:41 (4 months ago)
Author:
vain
Message:
  • cleanups for getModel(), saveModel()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/modulecontroller.core.php

    r5922 r5979  
    119119 
    120120    /** 
    121      * Proxy/Convenience Getter Method for the current Repository 
    122      * 
    123      * @param string $entityName 
     121     * Proxy/Convenience Getter Method for the Repository of the current Module. 
     122     * 
     123     * 
     124     * @param string $entityName Name of an Entity, like "\Entities\User". 
    124125     * @return Doctrine\ORM\EntityRepository 
    125126     */ 
     
    130131            $entityName = $this->getEntityNameFromClassname(); 
    131132        } 
    132         #Clansuite_Debug::firebug($entityName); 
     133 
    133134        return $this->doctrine_em->getRepository($entityName); 
    134135    } 
     
    139140     * Flush (save all) 
    140141     * 
    141      * @param object  $model Entites/xy 
     142     * @param object  $model Entity. 
    142143     * @param boolean $flush Uses flush on true, save on false. Defaults to flush (true). 
    143144     */ 
    144     public function saveModel($model, $flush = true) 
    145     { 
    146         $em = $this->doctrine_em; 
    147         $em->persist($model); 
     145    public function saveModel(\Doctrine\ORM\Mapping\Entity $model, $flush = true) 
     146    { 
     147        $this->doctrine_em->persist($model); 
    148148 
    149149        if($flush === true) 
    150150        { 
    151             $em->flush(); 
     151            $this->doctrine_em->flush(); 
    152152        } 
    153153        else 
    154154        { 
    155             $em->save(); 
     155            $this->doctrine_em->save(); 
    156156        } 
    157157    } 
Note: See TracChangeset for help on using the changeset viewer.