public function getStorePromotionLogoURL(\StorePromotion $storePromotion, $size = 'm') { if ($storePromotion->p_image) { return \URL::to('uploads/promotions/' . $size . '/' . $storePromotion->id . '/' . $storePromotion->p_image); } else { if ($storePromotion->isActive()) { return \URL::to('assets/img/icons/svg/noimage-promo.svg'); } else { return \URL::to('assets/img/icons/svg/noimage-promo-inactive.svg'); } } }
public function delete() { $promotions = StorePromotion::getPromotions($this->getID()); foreach ($promotions as $promotion) { $promotion->delete(); } $em = Database::get()->getEntityManager(); $em->remove($this); $em->flush(); }