Skip to content

Commit

Permalink
Merge pull request #2244 from omeka/remove-automatic-index-reset
Browse files Browse the repository at this point in the history
Remove automatic reset of query builder index
  • Loading branch information
zerocrates authored Dec 6, 2024
2 parents db89905 + 7995236 commit 7ca3603
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions application/src/Api/Adapter/AbstractEntityAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ public function search(Request $request)
// Begin building the search query.
$entityClass = $this->getEntityClass();

$this->index = 0;
$qb = $this->getEntityManager()
->createQueryBuilder()
->select('omeka_root')
Expand Down Expand Up @@ -700,7 +699,6 @@ public function findEntity($criteria, $request = null)
}

$entityClass = $this->getEntityClass();
$this->index = 0;
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('omeka_root')->from($entityClass, 'omeka_root');
foreach ($criteria as $field => $value) {
Expand Down Expand Up @@ -758,6 +756,14 @@ public function createAlias($prefix = 'omeka_')
return $alias;
}

/**
* Reset the index for query builder named parameters / aliases.
*/
public function resetIndex()
{
$this->index = 0;
}

/**
* Determine whether a string is a valid JSON-LD term.
*
Expand All @@ -779,7 +785,6 @@ public function isTerm($term)
*/
public function isUnique(EntityInterface $entity, array $criteria)
{
$this->index = 0;
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('e.id')
->from($this->getEntityClass(), 'e');
Expand Down

0 comments on commit 7ca3603

Please sign in to comment.