symfony - symfony2 - WI put my Model Classes , I coul not find it -


i using codeigniter php framework , decided learn sf instead of ci. because ci stopped updating new versions.

i have

-src -post -postbundle -postcontroller -commentcontroller ......

and want use mode named post_model.

in post_model class want use these functions ,

class post_model {     public function lasttenposts() {        $posts= $this->getdoctrine()               ->getrepository('postpostbundle:posts')                    .................. etc ...........                }    public function mostpopulerposts() {       /*  want use doctrine in theese functions  */                 }    public function mostcommentedposts() {            }  } 

in model file , want use doctrine functions connect , data db.

where should put post_mode.php file in sf , how can use doctrine in model. how can include doctrine functions.

thanks lot helping.

i think isn't approach using doctrine 2. should consider decoupling saving / data-stuff logic model doctrine 2 isn't active record implementation.

maybe should implement daos , delegate them process of saving / loading datas / model objects? then, have no direct entitymanager accesses in controllers nor in model , able daos services.


Comments