Пример #1
0
 public function preUpdate(PreUpdateEventArgs $args)
 {
     $entity = $args->getEntity();
     if ($entity instanceof User) {
         list($old, $new) = $this->getChangesets($args);
         if ($old) {
             $changeset = new ProfileChangeset();
             $changeset->setUser($entity);
             $changeset->setOld($old);
             $changeset->setNew($new);
             $this->changeset = $changeset;
         }
     }
 }
Пример #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $container = $this->getContainer();
     $em = $container->get('doctrine')->getEntityManager();
     $id = $input->getArgument('id');
     $old = $input->getArgument('old');
     $new = $input->getArgument('new');
     $user = $em->createQuery("\n\t\t\tSELECT u\n\t\t\tFROM EvrikaMainBundle:User u\n\t\t\tWHERE u.id = {$id}\n\t\t")->getSingleResult();
     $changeset = new ProfileChangeset();
     $changeset->setUser($user);
     $changeset->setOld($old);
     $changeset->setNew($new);
     $em->persist($changeset);
     $em->flush($changeset);
 }