$c = new Criteria();
$c->add(your delete criteria);

EventPeer::doDelete($c);

That will delete the rows according to your criteria without hydrating  
objects into memory.

On Oct 22, 2009, at 12:24 PM, fbg wrote:

>
> Suppose that I have a symfony 1.0 app and perform a propel query, work
> with the results a bit, and then wish to delete the underlying
> database records (for example, to scrub a log table, send out any
> needed alert emails, and roll the log events into a flat file to keep
> the DB fresh).
>
> What is the most efficient way to tell sf to do the delete?
>
> eg:
>
> ...criteria...LIMIT 1000 OFFSET N ...
> $results = doSelect (or doSelectRs) ...
> foreach($results as $result)
> {
> // process the result then:
> $result->delete();
> }
>
> OR, is there a $results->delete();  if so, are they equivalent?
>
> What I'm wondering about is whether sf will generate 1000 DELETE SQL
> requests, or whether there will be something else like DELETE ...
> WHERE id IN (i1,i2,...,i1000).  I assume the latter would be much more
> efficient.  Comments?
>
> Thanks in advance for any advice.
>
> >

--
Jacob Coby







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to