Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More then one where_raw #236

Closed
onlysli opened this issue Oct 1, 2014 · 3 comments
Closed

More then one where_raw #236

onlysli opened this issue Oct 1, 2014 · 3 comments

Comments

@onlysli
Copy link

onlysli commented Oct 1, 2014

Hi,
It seems that i can't use more then one where_raw in one statement. Only the first one is working, the second one is ignored.

Is there a fix for this?

Thank you!

@treffynnon
Copy link
Collaborator

Please include the code you're using.

@onlysli
Copy link
Author

onlysli commented Oct 1, 2014

I have to filters:

//filter url
public static function url($orm, $url) {
        return $orm->where_raw('( `url_rewrite` = ? ) OR ( `url_rewrite_en` = ? )', array($url, $url));
}

//filter visible
public static function visibles($orm) {
        return $orm->where('trash', 0)->where('activ', 1)
        ->where_raw('(( DATE(`start_date`) <= ? ) AND ((`end_date` != ? AND DATE(`end_date`) >= ?) OR (`end_date` = ? OR `end_date` = \'\')))', array(date("Y-m-d"), '0000-00-00', date("Y-m-d"), '0000-00-00'));
 }

and used together:

$spot = Model::factory('Spots')->filter('url', $this->principal_arguments)->filter('visibles')->find_one();

Will ignore second filter.

I also tried to use the where_row directly without filters but same effect.

Thank you.

@treffynnon
Copy link
Collaborator

I have written a test to verify this and I cannot replicate the issue you're having. Please see https://github.com/j4mie/idiorm/blob/develop/test/QueryBuilderTest.php#L295

If you run the test suite and still get failures please open a new ticket.

Repository owner locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants