public static function findBy($criteria = [], $single = false)
    {
        global $wpdb;
        $return = [];
        $query = static::getQueryByCriteria($criteria);
        $dbResults = $wpdb->get_results($query);

        if ($single && isset($dbResults[0])) {
            return static::getModelFromDBObject($dbResults[0]);
        }

        foreach ($dbResults as $object) {
            $return[] = static::getModelFromDBObject($object);
        }

        return $return;
    }
public static function findBy($criteria = [], $single = false)
    {
        global $wpdb;
        $return = [];
        $query = static::getQueryByCriteria($criteria);
        $dbResults = $wpdb->get_results($query);

        if ($single && isset($dbResults[0])) {
            return static::getModelFromDBObject($dbResults[0]);
        }

        foreach ($dbResults as $object) {
            $return[] = static::getModelFromDBObject($object);
        }

        return $return;
    }
public static function findBy ( $ criteria = [ ] , $ single = false ) { global $ wpdb ; $ return = [ ] ; $ query = static :: getQueryByCriteria ( $ criteria ) ; $ dbResults = $ wpdb -> get_results ( $ query ) ; if ( $ single && isset ( $ dbResults [ 0 ] ) ) { return static :: getModelFromDBObject ( $ dbResults [ 0 ] ) ; } foreach ( $ dbResults as $ object ) { $ return [ ] = static :: getModelFromDBObject ( $ object ) ; } return $ return ; }
Get all elements from DB who's contain the same criteria.

@param array $criteria
@param string $single

@return unknown|multitype:NULL
Get all elements from DB who s contain the same criteria .