repository = $repository; return $this; } public function getRepository() { return $this->repository; } public function execute() { if (!$this->getRepository()) { throw new Exception('Call setRepository() before execute()!'); } return $this->executeQuery(); } }