Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove object filtering within alias generator #7210

Merged
merged 2 commits into from Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/bundles/LeadBundle/Entity/LeadFieldRepository.php
Expand Up @@ -29,7 +29,7 @@ class LeadFieldRepository extends CommonRepository
*
* @return array
*/
public function getAliases($exludingId, $publishedOnly = false, $includeEntityFields = true, $object = 'lead')
public function getAliases($exludingId, $publishedOnly = false, $includeEntityFields = true, $object = null)
escopecz marked this conversation as resolved.
Show resolved Hide resolved
{
$q = $this->_em->getConnection()->createQueryBuilder()
->select('l.alias')
Expand All @@ -47,9 +47,11 @@ public function getAliases($exludingId, $publishedOnly = false, $includeEntityFi
->setParameter(':true', true, 'boolean');
}

$q->andWhere(
$q->expr()->eq('l.object', ':object')
)->setParameter('object', $object);
if ($object) {
$q->andWhere(
$q->expr()->eq('l.object', ':object')
)->setParameter('object', $object);
}

$results = $q->execute()->fetchAll();
$aliases = [];
Expand Down
2 changes: 1 addition & 1 deletion app/bundles/LeadBundle/Helper/FieldAliasHelper.php
Expand Up @@ -52,7 +52,7 @@ public function makeAliasUnique(LeadField $field)
// make sure alias is not already taken
$repo = $this->fieldModel->getRepository();
$testAlias = $alias;
$aliases = $repo->getAliases($field->getId(), false, true, $field->getObject());
$aliases = $repo->getAliases($field->getId());
$count = (int) in_array($testAlias, $aliases);
$aliasTag = $count;

Expand Down