19declare(strict_types=1);
56 $on[] = sprintf(
'%s = %s', $association->field()->fieldName(), $association->referenceField()->fieldName());
57 $where[] = sprintf(
'%s IS NULL', $association->referenceField()->fieldName());
58 foreach ($definition->
ignoreValues() as $value_to_ignore) {
59 $where[] = sprintf(
'%s %s', $association->field()->fieldName(), $value_to_ignore);
63 $result = $this->
database->query(sprintf(
64 'SELECT COUNT(1) as violations FROM %s LEFT JOIN %s ON %s WHERE %s',
67 implode(
' AND ', $on),
68 implode(
' AND ', $where),
71 $result = $this->
database->fetchAssoc($result);
73 return new Result((
int) $result[
'violations']);
__construct(private ilDBInterface $database)
check(Definition $definition)
Example: $violations = $this->check(new Definition([ new Association(new Field('mail',...