Пример #1
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Image is new, it will return
  * an empty collection; or if this Image has previously
  * been saved, it will retrieve related ImageGalleryMaps from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Image.
  *
  * @param      Criteria $criteria optional Criteria object to narrow the query
  * @param      ConnectionInterface $con optional connection object
  * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  * @return ObjectCollection|ChildImageGalleryMap[] List of ChildImageGalleryMap objects
  */
 public function getImageGalleryMapsJoinGallery(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
 {
     $query = ChildImageGalleryMapQuery::create(null, $criteria);
     $query->joinWith('Gallery', $joinBehavior);
     return $this->getImageGalleryMaps($query, $con);
 }
Пример #2
0
 public function deleteGallery($id)
 {
     $gal = GalleryQuery::create()->findPk($id);
     if ($this->isEditor() && $gal->getIdUser() != $_SESSION["user"]->getId()) {
         $this->addPopup("danger", "Na odstranění této galerie nemáte dostatečná práva.");
         redirectTo('/administrace/galerie');
     }
     $images = $gal->getImages();
     foreach ($images as $i) {
         $imgs[] = $i->getId();
     }
     $maps = ImageGalleryMapQuery::create()->filterByIdGallery($id)->filterByIdImage($imgs)->find();
     foreach ($maps as $m) {
         $m->delete();
     }
     $gal->delete();
     $this->addPopup('success', 'Galerie ' . $gal->getName() . ' byla úspěšně odstraněna!');
     redirectTo('/administrace/galerie');
 }