This model behavior allows you to filter and limit model find operations.Containable allows you to streamline and simplify operations on your model bindings. It works by temporarily or permanently altering the associations of your models.
To use the new behavior, you can add it to the $actsAs property of your model:
You can also attach the behavior on the fly:
You can also invoke Containable’s magic from inside the find() call:
You can also filter the associated Comment data by specifying a condition:
f you want to filter the posts by the comments, so that posts without a comment by Daniel won’t be returned, the easiest way is to find all the comments by Daniel and contain the Posts.: