Created
September 23, 2016 14:13
-
-
Save discordier/683624414d493993d06f563a2f805b28 to your computer and use it in GitHub Desktop.
Find MetaModels items using a `ConditionAnd` rule.
This file contains hidden or 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
$attribute = $metaModel->getAttribute('price'); | |
$filter = $metaModel->getEmptyFilter(); | |
$andRule = new \MetaModels\Filter\Rules\Condition\ConditionAnd(); | |
$andRule | |
->addRule(new \MetaModels\Filter\Rules\Comparing\GreaterThan($attribute, 10)) | |
->addRule(new \MetaModels\Filter\Rules\Comparing\LessThan($attribute, 20)); | |
$filter->addFilterRule($andRule); | |
$items = $metaModel->findByFilter($filter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you mean "addChild" https://github.com/MetaModels/core/blob/master/src/MetaModels/Filter/Rules/Condition/ConditionAnd.php#L46
at row #5 and #6 ?