plugin/agenda/Manager/AgendaManager.php
public function replaceEventUser(User $from, User $to)
    {
        $events = $this->om->getRepository('ClarolineAgendaBundle:Event')->findBy(['user' => $from]);

        if (count($events) > 0) {
            foreach ($events as $event) {
                $event->setUser($to);
            }

            $this->om->flush();
        }

        return count($events);
    }
public function replaceEventUser(User $from, User $to)
    {
        $events = $this->om->getRepository('ClarolineAgendaBundle:Event')->findBy(['user' => $from]);

        if (count($events) > 0) {
            foreach ($events as $event) {
                $event->setUser($to);
            }

            $this->om->flush();
        }

        return count($events);
    }
public function replaceEventUser ( User $ from , User $ to ) { $ events = $ this -> om -> getRepository ( 'ClarolineAgendaBundle:Event' ) -> findBy ( [ 'user' => $ from ] ) ; if ( count ( $ events ) > 0 ) { foreach ( $ events as $ event ) { $ event -> setUser ( $ to ) ; } $ this -> om -> flush ( ) ; } return count ( $ events ) ; }
Find every Event for a given user and the replace him by another.

@param User $from
@param User $to

@return int
Find every Event for a given user and the replace him by another .