I wasn't ware of findAll() as I was looking wiki, found it on api then
using this:
$emails = $em->getRepository('Entities\BannedEmail')->findAll();
foreach ($emails as $email) {
$blah = $em->remove($email);
}
$em->flush($blah);
Am I in correct way to do so?
On Fri, Apr 18, 2014 at 6:31 PM, Herman Peeren <[email protected]>wrote:
> An ORM is to work with the objects and then, eventually persist some of
> that in a database. So you add, remove etc. emails from a collection (for
> instance of banned email adresses) and after being finished with a set of
> transactions you can put it to a database. The problem you have here is
> mostly because you rare trying to operate on teh database directly. That is
> much easier without an ORM. Why would you use Doctrine at all?
>
>
> On Friday, 18 April 2014 12:33:04 UTC+2, Parsifal wrote:
>>
>> I have an entity for BannedEmail, this has only one property 'email'.
>> In form this is separated by line, when submitted it should truncate
>> current table and exlode the submitted emails by '\n' then flush in foreach.
>>
>> 1) Should I certainly use dbal to truncate? or is there a way to emty the
>> table with ORM?
>>
>> 2) and when foreach the submitted data, flush() should be inside foreach,
>> or just persist should be inside foreach, and flush after foreach? as this
>> is per row, I guess each persist will ovverride the last one, so flush must
>> be inside foreach? right?
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.