/**
  * parse json object
  * @throws ReaderException
  * @return $this
  */
 public function parse()
 {
     try {
         $object = $this->factory->createCollectionFromData($this->request->getParams(), ObjectFactory::FORMAT_JCAL);
     } catch (\Exception $ex) {
         throw new ReaderException($ex->getMessage(), $ex->getCode(), $ex);
     }
     $this->setObject($object);
 }
 /**
  * parse json object
  * @throws ReaderException
  * @return $this
  */
 public function parse()
 {
     try {
         $inputStream = fopen('php://input', 'rb');
         $object = $this->factory->createCollectionFromData($inputStream, ObjectFactory::FORMAT_ICAL);
     } catch (\Exception $ex) {
         throw new ReaderException($ex->getMessage(), $ex->getCode(), $ex);
     }
     $this->setObject($object);
 }
示例#3
0
 /**
  * @param \PDOStatement $result
  * @return \OCA\Calendar\IObjectCollection
  */
 private function resultToCollection(\PDOStatement $result)
 {
     $entities = [];
     while ($row = $result->fetch()) {
         try {
             $entities[] = $this->rowToEntity($row);
         } catch (CorruptDataException $ex) {
             continue;
         }
     }
     return $this->factory->createCollectionFromEntities($entities);
 }
示例#4
0
 /**
  * {@inheritDoc}
  */
 public function findAll($type = ObjectType::ALL, $limit = null, $offset = null)
 {
     if ($this->objects instanceof IObjectCollection) {
         return $this->objects->ofType($type);
     }
     $data = $this->getData($this->subscription);
     try {
         $this->objects = $this->factory->createCollectionFromData($data, ObjectFactory::FORMAT_ICAL);
         foreach ($this->objects as $object) {
             /** @var IObject $object */
             $object->setCalendar($this->calendar);
         }
         return $this->objects->ofType($type);
     } catch (ParseException $ex) {
         throw new CorruptDataException('CalendarManager-data is not valid!');
     }
 }