FuelPHP orm find all criteria with WHERE OR & AND is easy to achieve is we understand the concept behind and built the correct array.
The documentation stated as below without multiple criteria such as ‘WHERE (status = “single” OR status = “married”) AND name = “superman” ‘
// find all articles from category 1 or category 2 $entry = Model_Article::find('all', array( 'where' => array( array('category_id', 1), 'or' => array( array('category_id', 2), ), ), ));
My success example is as below:
$scope[] = array('status', 'single'); $scope['or'] = array('status', 'married'); $scope_and = array('name', '=', 'superman'); $data['user'] = \Model_User::find('all', array( 'where' => array($scope, $scope_and), 'order_by' => array('created_at' => 'desc') ) );
What do you think?