Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Umoe\ContractsBundle\Manager;
- use Umoe\ContractsBundle\Model as Model;
- abstract class BaseManagerMongo
- {
- /*
- * Remember these.
- * We might even do this simple and just use one name, for the Manager, Model
- * and MongoDB collection.
- * Right now they are all the same but I define different names here.
- * Or rather, they have to be defined in the object extending this one.
- */
- // protected static $collection = 'Base';
- // protected static $model = 'Model\Base';
- protected $simple_mongo;
- public function __construct($simple_mongo)
- {
- $this->simple_mongo = $simple_mongo;
- }
- /*
- * Finders
- */
- public function findAll()
- {
- $objects = array();
- foreach ($this->simple_mongo->findAll(static::$collection) as $o)
- {
- // $object = new Model\Contract($data);
- $object = new static::$model($o);
- $object->setId($o['_id']);
- $objects[] = $object;
- }
- return $objects;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement