@param EntityRepository $repository
@param array $entityIds

@throws \Doctrine\ORM\Query\QueryException
327938
private function deleteRolesByEntityIds(EntityRepository $repository, array $entityIds)
    {
        $qb = $repository->createQueryBuilder('role')
            ->delete()
            ->where('role.entityId IN (:ids)')
            ->setParameter('ids', $entityIds);

        $qb->getQuery()->execute();
    }
585297
public function getRepositoryEntities($repository)
    {
        if (!isset($this->_repository_entities[$repository])) {
            $this->_repository_entities[$repository] =
                $this->getService('anahita:domain.entityset', array('repository' => $this));
        }

        return $this->_repository_entities[$repository];
    }
506524
public function getEntitiesBy(array $criteria = [], array $orders = [], $limit = null, $offset = null): array
    {
        $entities = $this->getRepository()->findBy($criteria, $orders, $limit, $offset);
        $this->prepareEntitesForGet($entities);

        return $entities;
    }
309612
protected function assignEntity($entity)
    {
        $entityClass = $this->model->entity();

        if ($entity === null) {
            throw new QueryException(sprintf('Missing required entity of class "%s"', $entityClass));
        }

        if (!is_array($entity) && !$entity instanceof $entityClass) {
            throw new QueryException(sprintf('Entity must be an instance of "%s" or array got "%s"', $entityClass, $this->getType($entity)));
        }

        $this->instance = $entity;
    }
979637
protected function createRepositories(array $repositories = null)
    {
        if (null !== $repositories) {
            foreach ($repositories as $index => $repository) {
                $repositories[$index] = $this->createRepository(
                    new ObjectAccess($repository)
                );
            }
        }

        return $repositories;
    }
55037
public function delete(Repository $repository = null)
    {
        if (!$repository) {
            $repository = $this->getRepository();
        }

        $repository = $repository->aliased('write');

        $delete = $this->getQuery()->transformToDelete();

        $prepare = $repository->prepareQuery($delete);

        return $repository->executePrepared($prepare);
    }
142605
public function findBy(
        string $entityNamespace,
        array $criteria
    ): array {
        return $this
            ->getObjectRepository($this->locateEntity($entityNamespace))
            ->findBy($criteria);
    }
810551
public function generateEntityRepositoryClass(string $entityClass, string $repositoryClass)
    {
        $variables = [
            '<namespace>' => $this->generateEntityRepositoryNamespace($repositoryClass),
            '<entityClassName>' => $entityClass,
            '<entity>' => $this->generateEntityName($entityClass),
            '<repository>' => $this->generateClassName($repositoryClass),
        ];

        return str_replace(array_keys($variables), array_values($variables), self::$_template);
    }
346230
private function updateEntity($property, EntityInterface $entity, Repository $repository, ParametersCollection $configuration)
    {
        if ($configuration->offsetExists('on') && $onEvent = $configuration->offsetGet('on')) {
            
            $onEvent = !static::isIterable($onEvent) ? [$onEvent] : $onEvent;
            
            foreach ($onEvent as $onEventName) {
                if (($onEventName === Timestampable::ON_CREATE && $repository->isNewEntity($entity)) || $onEventName === Timestampable::ON_UPDATE) {
                    $entity->setByProperty($property, new DateTime());
                }
            }
            
            return null;
        }
        
        throw new ExtensionException('Wrong configuration passed to Timestampable extension');
    }
302941
protected function indexActionInternal($entities): void {
        $objects = [];
        foreach($entities as $entity) {
            $objects[] = $this->generateEntityAction($entity);
        }
        $outputObject = $this->getOutputObject();
        $blankEntity = $this->generateEntity();
        $outputObject->{$blankEntity->getEntityName() . 's'} = $objects;

        $this->setOutputObject($outputObject);
    }
193263
public static function generateMap($entities, $entityId, $entityClass)
    {
        $entityMap = [];
        foreach ($entities as $entity) {
            if ($entity instanceof $entityClass) {
                $entityObject = $entity;
            } else {
                $entityObject = new $entityClass;
                foreach ($entity as $key => $value) {
                    $propSetter = 'set'.ucfirst($key);
                    if (method_exists($entityObject, $propSetter)) {
                        $entityObject->$propSetter($value);
                    }
                }
            }

            if (is_null($entityId)) {
                array_push($entityMap, $entityObject);
            } else {
                $propKeyGetter = 'get'.ucfirst($entityId);
                $entityMap[$entityObject->$propKeyGetter()] = $entityObject;
            }
        }

        return $entityMap;
    }
778780
public function getOne($repository, $id)
    {
        $repoConfig = $this->repos[$repository];
        /** @var $q \Doctrine\ORM\QueryBuilder */
        return $this->doctrine
            ->getRepository($repoConfig['repository'])
            ->find($id);
    }
701977
public function indexEntity(SearchableEntityInterface $entity)
    {
        foreach ($this->locales as $locale) {
            $this->addEntityToIndex($entity, $locale);
        }

        if (!empty($this->documents)) {
            $response = $this->searchProvider->addDocuments($this->documents);
            $this->documents = [];
        }
    }
1365991
public function list($entityCode, $entityId, $param = null)
    {
        $entityCode = strtolower($entityCode);
        $uriAppend  = "{$entityCode}/{$entityId}";

        $params     = $this->getQueryParams();
        $response   = $this->handler->handle('GET', false, $uriAppend, $params);

        return $this->make($response);
    }
756012
public function getIds($entityType, array $selector = [], array $params = [])
    {
        $params['fields'] = '_id';

        return array_column($this->search($entityType, $selector, $params), '_id');
    }
643888
public void setRepositories(java.util.Collection<Repository> repositories) {
        if (repositories == null) {
            this.repositories = null;
            return;
        }

        this.repositories = new java.util.ArrayList<Repository>(repositories);
    }
612804
public function injectEntityDependencies(EntityInterface $entity): void
    {
        $this->buildEntityInjectMethodsForEntity($entity);
        $entityFqn = $this->leadingSlash($entity::getDoctrineStaticMeta()->getReflectionClass()->getName());
        $this->injectStatic($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_STATIC]);
        $this->inject($entity, $this->entityInjectMethods[$entityFqn][self::TYPE_KEY_INSTANCE]);
    }