Last active
February 13, 2017 10:00
-
-
Save anthonybudd/3e36fc17204f9468d3d14ada7351ec87 to your computer and use it in GitHub Desktop.
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
| <?php | |
| Class Product extends WP_Model | |
| { | |
| ... | |
| public function _finderHeavy($agrs){ | |
| ... | |
| } | |
| public function _postFinderHeavy($results, $args){ | |
| return array_map(function($model){ | |
| if($model->color == 'blue'){ | |
| return $model; | |
| } | |
| }, $results); | |
| } | |
| } | |
| $heavyProducts = Product::finder('heavy', ['heavierThan' => 250]); // [Product, Product, Product]; | |
| echo $heavyProducts[0]->color; // 'blue' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment