spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

how to do this in spot orm (multiple and/or) #209

Closed marcelloh closed 7 years ago

marcelloh commented 7 years ago

SELECT * FROM posts WHERE (status = 'published' OR WHERE status = 'draft') AND (year = 2016 OR year =2015) AND (....)

I try to find it in the documentation, or figure out doing it in the software... but it's unclear to me for now.

FlipEverything commented 7 years ago

I think you can do something like this, right? Somebody correct me If I'm wrong.

$mapper -> $spot->mapper('Entity\Posts');
$posts = $mapper->where('status IN' => ['published', 'draft'], 'year IN' => ['2015', '2016']);
marcelloh commented 7 years ago

Sound like a very good solution :-) I was stuck in where/andwhere/orwhere kind of things so I didn't see the obvious.