plugin/agenda/Manager/AgendaManager.php
public function import($fileData, $workspace = null)
    {
        $ical = new ICal($fileData);
        $events = $ical->events();
        $entities = [];

        foreach ($events as $event) {
            $e = new Event();
            $e->setTitle($event->summary);
            $e->setStart($ical->iCalDateToUnixTimestamp($event->dtstart));
            $e->setEnd($ical->iCalDateToUnixTimestamp($event->dtend));
            $e->setDescription($event->description);
            if ($workspace) {
                $e->setWorkspace($workspace);
            }
            $e->setUser($this->tokenStorage->getToken()->getUser());
            $e->setPriority('#01A9DB');
            $this->om->persist($e);
            //the flush is required to generate an id
            $this->om->flush();
            $entities[] = $e;
        }

        return $entities;
    }
public function import($fileData, $workspace = null)
    {
        $ical = new ICal($fileData);
        $events = $ical->events();
        $entities = [];

        foreach ($events as $event) {
            $e = new Event();
            $e->setTitle($event->summary);
            $e->setStart($ical->iCalDateToUnixTimestamp($event->dtstart));
            $e->setEnd($ical->iCalDateToUnixTimestamp($event->dtend));
            $e->setDescription($event->description);
            if ($workspace) {
                $e->setWorkspace($workspace);
            }
            $e->setUser($this->tokenStorage->getToken()->getUser());
            $e->setPriority('#01A9DB');
            $this->om->persist($e);
            //the flush is required to generate an id
            $this->om->flush();
            $entities[] = $e;
        }

        return $entities;
    }
public function import ( $ fileData , $ workspace = null ) { $ ical = new ICal ( $ fileData ) ; $ events = $ ical -> events ( ) ; $ entities = [ ] ; foreach ( $ events as $ event ) { $ e = new Event ( ) ; $ e -> setTitle ( $ event -> summary ) ; $ e -> setStart ( $ ical -> iCalDateToUnixTimestamp ( $ event -> dtstart ) ) ; $ e -> setEnd ( $ ical -> iCalDateToUnixTimestamp ( $ event -> dtend ) ) ; $ e -> setDescription ( $ event -> description ) ; if ( $ workspace ) { $ e -> setWorkspace ( $ workspace ) ; } $ e -> setUser ( $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ) ; $ e -> setPriority ( '#01A9DB' ) ; $ this -> om -> persist ( $ e ) ; //the flush is required to generate an id $ this -> om -> flush ( ) ; $ entities [ ] = $ e ; } return $ entities ; }
Imports ical files.

@param UploadedFile $file
@param Workspace    $workspace

@return int number of events saved
Imports ical files .