public function edit(array $data, $idGallery, $oldLang)
 {
     if ($data['translate'] != null) {
         $data['idGallery'] = $data['translate'];
     }
     $lang = $data['language'];
     $data['lang'] = $lang;
     unset($data['language']);
     unset($data['translate']);
     $images = $data['images'];
     unset($data['images']);
     try {
         $result = parent::update($data, ['idGallery' => $idGallery, 'lang' => $oldLang]);
     } catch (UniqueConstraintViolationException $ex) {
         throw new EntityExistsException('Galerie již existuje');
     }
     if ($idGallery != $data['idGallery'] || $oldLang != $data['lang']) {
         $this->onChangePrimary($idGallery, $data['idGallery'], $oldLang, $data['lang']);
     }
     if (!empty($images)) {
         $this->onGallerySave($data['idGallery'], $data['lang'], $images);
     }
     return $result;
 }
 /**
  * @param array $by
  * @return bool
  */
 public function delete(array $by)
 {
     $article = $this->find($by['idArticle'], $by['lang']);
     if (!$article) {
         throw new EntityExistsException('Tento článek neexistuje');
     }
     $this->imageMapper->delete(articleImagesPath . $article->image);
     return parent::delete($by);
 }
 public function __construct(EntityManager $entityManager)
 {
     parent::__construct($entityManager);
     $this->taskGroup = $this->entityManager->getRepository(Entity\TaskGroup::getClassName());
 }
示例#4
0
 public function __construct(LogDbMapper $logDbMapper)
 {
     parent::__construct($logDbMapper);
     $this->mapper = $logDbMapper;
 }
示例#5
0
 /**
  * @param UserDatabaseMapper $userDatabaseMapper
  */
 public function __construct(UserDatabaseMapper $userDatabaseMapper)
 {
     parent::__construct($userDatabaseMapper);
     $this->mapper = $userDatabaseMapper;
 }
示例#6
0
 /**
  * @param array $by
  * @return bool
  */
 public function delete(array $by)
 {
     $offer = $this->find($by['idOffer'], $by['lang']);
     if (!$offer) {
         throw new EntityExistsException('Tato nabídka neexistuje');
     }
     $this->imageMapper->delete(offerImagesPath . $offer->image);
     return parent::delete($by);
 }