public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { $account = $this->getParameter('account'); $properties = $targetEntity->getReflectionProperties(); $dql = ''; if (isset($properties['account'])) { $dql = $targetTableAlias . '.account = ' . $account; } return $dql; }