Propel
Propel copied to clipboard
update() with limit()
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?
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
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.