Checks whether links to a given association exist / do not exist.
string
'linked'
string
'notLinked'
\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.
__construct(mixed $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 $options)
Callable handler.
Performs the actual link check.
\Cake\Datasource\EntityInterface
$entity The entity involved in the operation.
array
$options Options passed from the rules checker.
bool
Whether the check was successful.
_aliasFields(array $fields, \Cake\ORM\Table $source)
Alias fields.
array
$fields The fields that should be aliased.
\Cake\ORM\Table
$source The object to use for aliasing.
array
The aliased fields
_buildConditions(array $fields, array $values)
Build conditions.
array
$fields The condition fields.
array
$values The condition values.
array
A conditions array combined from the passed fields and values.
_countLinks(\Cake\ORM\Association $association, \Cake\Datasource\EntityInterface $entity)
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 number of links.
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.1/class-Cake.ORM.Rule.LinkConstraint.html