<?php
namespace App\Controller\Informations;
use Pimcore\Controller\FrontendController;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
use Pimcore\Localization\LocaleServiceInterface;
use Pimcore\Model\DataObject\ClassDefinition\Service;
use Pimcore\Model\DataObject\Aboutus;
use Pimcore\Model\DataObject\ChefSpecial;
use Pimcore\Model\DataObject\News;
use Pimcore\Model\DataObject\Slider;
use Pimcore\Model\DataObject\Events;
use Pimcore\Model\DataObject\Userloyaltyprogram;
class aboutusController extends FrontendController{
public function aboutusAction(Request $request){
$aboutus = new Aboutus\Listing();
$aboutus->setLimit(1);
$aboutus->load();
foreach($aboutus as $about_us){
break;
}
$chef = new ChefSpecial\Listing();
$chef->load();
$news = new News\Listing();
// $news->setCondition("featured = 0");
$news->load();
//dd($news);
$featured_news = new News\Listing();
$featured_news->setCondition("featured = 1");
$featured_news->setLimit(1);
$featured_news->load();
foreach($featured_news as $featurednews){
break;
}
$aboutusslider = new Slider\Listing();
$aboutusslider->setCondition("o_id = 347");
$aboutusslider->setLimit(1);
$aboutusslider->load();
if(empty($aboutusslider->getdata()[0]->getsliders())){
$aboutusslider = array();
}else{
$aboutusslider = $aboutusslider->getdata()[0]->getsliders();
}
$featured_events = new Events\Listing();
$featured_events->setCondition('featured IN (?)','1');
// $featured_events->addConditionParam('date_time >= ?',time());
$featured_events->setLimit(1);
$featured_events->load();
$F_event_id = 0;
foreach($featured_events as $Featured_events){
$F_event_id=$Featured_events->getId();
break;}
// dd($F_event_id);
$uid = $this->get('session')->get('loginUID');
$LikedEventfeature = new Userloyaltyprogram\Listing();
$LikedEventfeature->setCondition("op_name = ? and u_id = ? and obj_id = ?",['Like',$uid,$F_event_id]);
$LikedEventfeature->load();
//dd(count($LikedEventfeature));
//dd($LikedEventfeature);
//dd($about_us->getHistory()[0]['localizedfields']['year'][0]);
// dd($about_us->getHistory()[0]->getLocalizedfields()->getData()->getLocalizedValue('year','en'));
return $this->render('Informations/aboutus.html.twig',
[
'aboutus'=> $about_us,
'ourchef'=>$chef,
'news'=>$news,
'featurednews'=>$featurednews,
'aboutusslider'=>$aboutusslider,
'Featured_events' => $Featured_events,
'LikedEventfeature' => $LikedEventfeature,
]);
}
}