public function __construct(Factory $factory, $id = Null) { $this->logger = $factory->getLogger(); $this->db = $factory->getDb(); $this->collection = $factory->getCollection(); if (!$this->collection) { throw new Exception('Created model with no collection'); } $this->factory = $factory; $this->id = $id; }