Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion problem evet listener doctrine
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marco Pivetta  
View profile  
 More options Oct 8 2012, 6:36 am
From: Marco Pivetta <ocram...@gmail.com>
Date: Mon, 8 Oct 2012 12:36:17 +0200
Local: Mon, Oct 8 2012 6:36 am
Subject: Re: [Symfony2] problem evet listener doctrine

You can use `$uow->scheduleForInsert($modificacion);` (
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Un...)
Marco Pivetta

http://twitter.com/Ocramius

http://marco-pivetta.com

On 8 October 2012 12:30, joselito <paradit...@gmail.com> wrote:

> class ListenerCrud{

>     protected $container;

>     public function __construct(ContainerInterface $container)
>     {
>         $this->container = $container;
>     }

>     public function onFlush(onFlushEventArgs $eventArgs)
>         {
>                 $em = $eventArgs->getEntityManager();
>                 $uow = $em->getUnitOfWork();

>                 foreach ($uow->getScheduledEntityInsertions() AS $entity) {
>                     if (!$entity instanceof Modificacion) {
>                         $modificacion = new Modificacion();
>                         $modificacion->setFechamod(new \DateTime('now'));
>                         $className = join('', array_slice(explode('\\',
> get_class($entity)), -1));
>                         $modificacion->setEntidad($className);
>                         $modificacion->setTipo('Inserción');
>                         $hola = $this->getConfiguration($em, $meta->name)
>                         $modificacion->setIdentificador('bbbb');// add the
> id inserted ????
>                         $securityContext =
> $this->container->get('security.context');

> $modificacion->setEmpleado($securityContext->getToken()->getUser());
>                         $modificacion->setInfo('');
>                         $em->persist($modificacion);
>                         $classMetadata =
> $em->getClassMetadata(get_class($modificacion));
>                         $uow->computeChangeSet($classMetadata,
> $modificacion);
>                         }
>                     }

> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com

> You received this message because you are subscribed to the Google
> Groups "Symfony2" group.
> To post to this group, send email to symfony2@googlegroups.com
> To unsubscribe from this group, send email to
> symfony2+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony2?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.