Propel Criteria parameter corruption

Discussion relating to version 1.2.x stable

Propel Criteria parameter corruption

Postby superpatty » Thu Sep 30, 2010 12:57 am

I have come across a bug that seems to be overwriting some of my parameters with other parameters when the Propel generates the SQL.

No matter the order I arrange my Criteria, the last parameter is always mostly overridden by (I believe) the first two digits of the first where clause value.

Code: Select all
                        $selected_seismo_data_list = array(86,88,89,91,92,94,120);
         $start      = '2010-09-01 00:00:00';
         $end             = '2010-09-30 23:59:59';      
         $value   ='110';
         $event_c   = new Criteria();
         $event_c->add(ActivitySeismoInfoPeer::ASI_ACTIVITY_ID, null, Criteria::ISNOTNULL);
         $event_c->add(ActivitySeismoInfoPeer::ASI_SEISMO_ID, $selected_seismo_data_list, Criteria::IN);
         $event_c->add(ActivitySeismoInfoPeer::ASI_PEAK_SOUND, $value, constant('Criteria::'.strtoupper($comparator)));

         $start_crit = $event_c->getNewCriterion(ActivitySeismoInfoPeer::ASI_EVENT_TIME, $start, Criteria::GREATER_EQUAL);
         $end_crit   = $event_c->getNewCriterion(ActivitySeismoInfoPeer::ASI_EVENT_TIME, $end, Criteria::LESS_EQUAL);

         $start_crit->addAnd($end_crit);
         $event_c->add($start_crit);
            
         $event_c->addDescendingOrderByColumn(ActivitySeismoInfoPeer::ASI_EVENT_TIME);
         
         $this->event_list = ActivitySeismoInfoPeer::doSelectJoinActivityInfo($event_c);



And the SQL that is executed is:
Code: Select all
SELECT .....
FROM `activity_seismo_info`

LEFT JOIN activity_info ON (activity_seismo_info.ASI_ACTIVITY_ID=activity_info.ID)

WHERE
activity_seismo_info.ASI_ACTIVITY_ID IS NOT NULL AND
activity_seismo_info.ASI_PEAK_SOUND>'110' AND
activity_seismo_info.ASI_SEISMO_ID IN (86,88,89,91,92,94,120) AND
(
    activity_seismo_info.ASI_EVENT_TIME>='2010-09-01 00:00:00' AND
    activity_seismo_info.ASI_EVENT_TIME<='110'0
)

ORDER BY activity_seismo_info.ASI_EVENT_TIME DESC


Any help would be greatly appreciated.

Thanks

patrick
patrick

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius, and a lot of courage to move in the opposite direction.
~ Albert Einstein
superpatty
Member
 
Posts: 33
Joined: Wed Dec 03, 2008 6:49 pm
Location: Atlanta, GA

Re: Propel Criteria parameter corruption

Postby halfer » Mon Oct 04, 2010 10:49 pm

If you're using Symfony 1.2, I believe you'll be using Propel 1.3. This appears to be hardwired at a particular revision (as per this), so maybe you'll get some bug fixes if you update this to the trunk version of 1.3? That said, there appears to be only one stable release.

Even better, if you can upgrade to Symfony 1.3, you'll get Propel 1.4 instead, I think.

If you're stuck, add the offending clause in as custom sql - at least that will get you going.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK


Return to symfony 1.2

Who is online

Users browsing this forum: No registered users and 0 guests