private function addPermissionableConditionIfNot(HasMany $relation) { $foundGroupCondition = false; $query = $relation->getQuery(); foreach ($query->getWhere() as $where) { foreach ($where->getChildren() as $key => $child) { if (strpos($key, $this->permissionablePermissionField)) { $foundGroupCondition = true; } } } if (!$foundGroupCondition) { $this->addPermissionableCondition($relation); } }
private function addTranslatableConditionIfNot(HasMany $relation) { $foundLanguageCondition = false; $query = $relation->getQuery(); foreach ($query->getWhere() as $where) { foreach ($where->getChildren() as $key => $child) { if (strpos($key, $this->translatableLanguageField)) { $foundLanguageCondition = true; } } } if (!$foundLanguageCondition) { $this->addTranslatableCondition($relation); } }