<?php
namespace Customize\Controller;
use Customize\Service\WordPressService;
use Eccube\Controller\AbstractController;
use Plugin\TabaCMS2\Repository\PostRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
class TopController extends AbstractController
{
/** @var WordPressService */
protected $wordPressService;
/** @var PostRepository */
protected $postRepository;
public function __construct(
WordPressService $wordPressService,
PostRepository $postRepository
) {
$this->wordPressService = $wordPressService;
$this->postRepository = $postRepository;
}
/**
* @Route("/", name="homepage", methods={"GET"})
* @Template("index.twig")
*/
public function index()
{
$condition = [
'public_div' => true,
];
$news = $this->postRepository->getList($condition, null);
$special_posts = $this->wordPressService->getItsukushiPosts('itsukushi_special', 1);
return [
'news' => $news,
'special_posts' => $special_posts,
];
}
}