Checks whether links to a given association exist / do not exist.
string
'linked'
Status that requires a link to be present.
string
'notLinked'
Status that requires a link to not be present.
Cake\ORM\Association|string
The association that should be checked.
string
The link status that is required to be present in order for the check to succeed.
Constructor.
Callable handler.
Alias fields.
Build conditions.
Count links.
__construct(Cake\ORM\Association|string $association, string $requiredLinkStatus)
Constructor.
Cake\ORM\Association|string
$association The alias of the association that should be checked.
string
$requiredLinkStatus The link status that is required to be present in order for the check to succeed.
__invoke(Cake\Datasource\EntityInterface $entity, array<string, mixed> $options): bool
Callable handler.
Performs the actual link check.
Cake\Datasource\EntityInterface
$entity The entity involved in the operation.
array<string, mixed>
$options Options passed from the rules checker.
bool
_aliasFields(array<string> $fields, Cake\ORM\Table $source): array<string>
Alias fields.
array<string>
$fields The fields that should be aliased.
Cake\ORM\Table
$source The object to use for aliasing.
array<string>
_buildConditions(array $fields, array $values): array
Build conditions.
array
$fields The condition fields.
array
$values The condition values.
array
_countLinks(Cake\ORM\Association $association, Cake\Datasource\EntityInterface $entity): int
Count links.
Cake\ORM\Association
$association The association for which to count links.
Cake\Datasource\EntityInterface
$entity The entity involved in the operation.
int
The association that should be checked.
Cake\ORM\Association|string
The link status that is required to be present in order for the check to succeed.
string
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.ORM.Rule.LinkConstraint.html