Last active
June 11, 2017 21:13
-
-
Save styks1987/0f09e418dd2de1c8d57b63d53d0a5158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Calling this model OtherItem | |
// in your model initialize function for your OtherItem | |
$this->addBehavior('CounterCache', [ | |
'PrimaryItems' => [ | |
'other_items_count' | |
] | |
]); | |
$this->hasMany('OtherItems', [ | |
'conditions' => [ | |
'OtherItems.someproperty = PrimaryItems.someproperty', | |
'OtherItems.date < PrimaryItems.date', | |
] | |
]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment