Login | Register
My pages Projects Community openCollabNet

Discussions > users > Criteria::IN backwards possible?

propel
Discussion topic

Back to topic list

Criteria::IN backwards possible?

Reply

Author Rihad <admin at azuni dot net>
Full name Rihad <admin at azuni dot net>
Date 2007-08-17 08:20:22 PDT
Message Hi, I'm trying to use Criteria::IN backwards, meaning to test whether a
given value equals any of the columns. Don't know if its standard SQL,
but for what it's worht PostgreSQL 8.2.4 can do that:

select * from my_table where 'some_input' in (col1, col2, col3);


Whatever Propel I've tried has failed:

$c->add(array(FooPeer::COL1, FooPeer::COL2, FooPeer::COL3),
   $something, Criteria::IN);
$c->add($something, array(FooPeer::COL1, FooPeer::COL2, FooPeer::COL3),
   $something, Criteria::IN);

Right now I'm doing it the ugly way (as per the example from the docs):

$c = new Criteria();
...
$criterion = $c->getNewCriter​ion(FooPeer::COL1, $something);
$criterion->addO​r($c->getNewCrit​erion(FooPeer::COL2'​),$something));
$criterion->addO​r($c->getNewCrit​erion(FooPeer::COL3'​),$something));
$c->add($criterion);


TIA

« Previous message in topic | 1 of 7 | Next message in topic »

Messages

Show all messages in topic

Criteria::IN backwards possible? Rihad <admin at azuni dot net> Rihad <admin at azuni dot net> 2007-08-17 08:20:22 PDT
     Re: [propel] Criteria::IN backwards possible? Martin Kreidenweis <80171 at gmx dot de> Martin Kreidenweis <80171 at gmx dot de> 2007-08-17 09:53:02 PDT
         Re: [propel] Criteria::IN backwards possible? Cameron Brunner <cameron dot brunner at gmail dot com> Cameron Brunner <cameron dot brunner at gmail dot com> 2007-08-17 10:27:13 PDT
             Re: [propel] Criteria::IN backwards possible? Martin Kreidenweis <80171 at gmx dot de> Martin Kreidenweis <80171 at gmx dot de> 2007-08-17 14:29:00 PDT
         Re: [propel] Criteria::IN backwards possible? Rihad <admin at azuni dot net> Rihad <admin at azuni dot net> 2007-08-17 12:28:17 PDT
         Re: [propel] Criteria::IN backwards possible? Rihad <admin at azuni dot net> Rihad <admin at azuni dot net> 2007-08-18 03:59:10 PDT
             Re: [propel] Criteria::IN backwards possible? Martin Kreidenweis <80171 at gmx dot de> Martin Kreidenweis <80171 at gmx dot de> 2007-08-19 12:18:39 PDT
Messages per page: