Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The conditions of your contain should go like this:</p> <pre><code>$this-&gt;paginate = array( 'Project' =&gt; array( 'limit' =&gt; $limit, 'contain' =&gt; array( 'ProjectReminderUser' =&gt; array( 'conditions' =&gt; array( 'ProjectReminderUser.user_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.id') ) ) ), 'conditions' =&gt; array( 'User.group_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.group_id'), 'Project.project_status_id' =&gt; PROJECT_STATUS_OPEN, ) ) ); </code></pre> <p>If you want to contain the User it should go like this:</p> <pre><code>$this-&gt;paginate = array( 'Project' =&gt; array( 'limit' =&gt; $limit, 'contain' =&gt; array( 'ProjectReminderUser' =&gt; array( 'conditions' =&gt; array( 'ProjectReminderUser.user_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.id') ) ), 'User' =&gt; array( 'conditions' =&gt; array( 'User.group_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.group_id'), ) ) ), 'conditions' =&gt; array( 'Project.project_status_id' =&gt; PROJECT_STATUS_OPEN, ) ) ); </code></pre> <p>Also make sure you have the Behavior in all the involved models.</p> <p>If you need to use joins:</p> <pre><code>$this-&gt;paginate = array( 'Project' =&gt; array( 'limit' =&gt; $limit, 'joins' =&gt; array( 'table' =&gt; 'project_reminder_users', 'alias' =&gt; 'ProjectReminderUser', 'type' =&gt; 'inner', 'conditions' =&gt; array( 'ProjectReminderUser.user_id = ' . $this-&gt;Session-&gt;read('Auth.User.id'), ) ), 'conditions' =&gt; array( 'User.group_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.group_id'), 'Project.project_status_id' =&gt; PROJECT_STATUS_OPEN, ) ) ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload