src/Controller/Informations/aboutusController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Informations;
  3. use Pimcore\Controller\FrontendController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Pimcore\Localization\LocaleServiceInterface;
  8. use Pimcore\Model\DataObject\ClassDefinition\Service;
  9. use Pimcore\Model\DataObject\Aboutus;
  10. use Pimcore\Model\DataObject\ChefSpecial;
  11. use Pimcore\Model\DataObject\News;
  12. use Pimcore\Model\DataObject\Slider;
  13. use Pimcore\Model\DataObject\Events;
  14. use Pimcore\Model\DataObject\Userloyaltyprogram;
  15. class aboutusController extends FrontendController{
  16.     public function aboutusAction(Request $request){
  17.         $aboutus = new Aboutus\Listing();
  18.         $aboutus->setLimit(1);
  19.         $aboutus->load();
  20.         foreach($aboutus as $about_us){
  21.             break;
  22.         }
  23.         $chef  = new ChefSpecial\Listing();
  24.         $chef->load();
  25.         $news = new News\Listing();
  26.        // $news->setCondition("featured = 0");
  27.         $news->load();
  28.         //dd($news);
  29.         $featured_news = new News\Listing();
  30.         $featured_news->setCondition("featured  = 1");
  31.         $featured_news->setLimit(1);
  32.         $featured_news->load();
  33.         foreach($featured_news as $featurednews){
  34.             break;
  35.         }
  36.         $aboutusslider = new Slider\Listing();
  37.         $aboutusslider->setCondition("o_id  = 347");
  38.         $aboutusslider->setLimit(1);
  39.         $aboutusslider->load();
  40.         if(empty($aboutusslider->getdata()[0]->getsliders())){
  41.             $aboutusslider = array();
  42.         }else{
  43.             $aboutusslider $aboutusslider->getdata()[0]->getsliders();
  44.         } 
  45.             $featured_events = new Events\Listing();
  46.             $featured_events->setCondition('featured IN (?)','1');
  47.            // $featured_events->addConditionParam('date_time >= ?',time());
  48.             $featured_events->setLimit(1);
  49.             $featured_events->load();
  50.             $F_event_id 0;
  51.             foreach($featured_events as $Featured_events){
  52.                 $F_event_id=$Featured_events->getId();
  53.                 break;}
  54.                // dd($F_event_id);
  55.                 $uid $this->get('session')->get('loginUID');
  56.                 $LikedEventfeature = new Userloyaltyprogram\Listing();
  57.                 $LikedEventfeature->setCondition("op_name = ? and u_id = ? and obj_id = ?",['Like',$uid,$F_event_id]);
  58.                 $LikedEventfeature->load();
  59.                 //dd(count($LikedEventfeature));
  60.                 //dd($LikedEventfeature);
  61.         //dd($about_us->getHistory()[0]['localizedfields']['year'][0]);
  62.        // dd($about_us->getHistory()[0]->getLocalizedfields()->getData()->getLocalizedValue('year','en'));
  63.         return $this->render('Informations/aboutus.html.twig',
  64.         [
  65.             'aboutus'=> $about_us,
  66.             'ourchef'=>$chef,
  67.             'news'=>$news,
  68.             'featurednews'=>$featurednews,
  69.             'aboutusslider'=>$aboutusslider,
  70.             'Featured_events'  =>  $Featured_events,
  71.             'LikedEventfeature'  =>  $LikedEventfeature,
  72.         ]);
  73.     }
  74. }