You cannot limit your main Model's results based on conditions within the Contain. When you use contain()
, it actually creates multiple queries - that keeps you from being able to limit based on contained conditions.
To resolve this, you need to use JOINs [ see CakePHP Joining Tables ] instead of contain.