injections['entityManager']; } protected function getUser() { return $this->injections['user']; } protected function getAcl() { return $this->injections['acl']; } protected function getMetadata() { return $this->injections['metadata']; } public function find($scope, $id, $params) { $entity = $this->getEntityManager()->getEntity($scope, $id); if (empty($entity)) { throw new NotFound(); } if (!$this->getAcl($entity, 'read')) { throw new Forbidden(); } $where = array( 'parentType' => $scope, 'parentId' => $id ); $collection = $this->getEntityManager()->getRepository('Note')->find(array( 'whereClause' => $where, 'offset' => $params['offset'], 'limit' => $params['maxSize'], 'orderBy' => 'createdAt', 'order' => 'DESC' )); $count = $this->getEntityManager()->getRepository('Note')->count(array( 'whereClause' => $where, )); return array( 'total' => $count, 'collection' => $collection, ); } }