Propel icon indicating copy to clipboard operation
Propel copied to clipboard

update() with limit()

Open ciromattia opened this issue 12 years ago • 2 comments

I got an unexpected behavior with update() combined with limit(). The following code:

ItemQuery::create()
->filterByStatus('A')
->filterByHome(2)
->orderByArrivalDate(Criteria::DESC)
->limit(1)
->update(array('Status' => 'B');

is expected to give the query

UPDATE `item` SET status = 'B'
WHERE item.status='A' AND item.home='2'
ORDER BY item.arrival_date DESC
LIMIT 1

which updates a SINGLE row (the last arrived). I got instead an update on ALL items filtered by the query, like the limit(1) was ignored by update(). Is it a known Propel behavior?

ciromattia avatar Aug 20 '13 10:08 ciromattia

Yes, this is a known issue. It was in the old Trac system: http://trac.propelorm.org/127.0.0.1_8882/ticket/987.html

jwong-dayspring avatar Sep 03 '14 17:09 jwong-dayspring

@jwong-dayspring

Your link is not working anymore. Is there a status if this gets fixed or a general way to work around? This is our workaround.

stevleibelt avatar Jun 09 '16 10:06 stevleibelt