Archive for: 󈥪月 2020’

Synfony2.8 パラメータ受け渡し(Controller ⇒ View)

2020年10月23日 Posted by PURGE

class SceduleController extends Controller
{
    /**
     * @Route("/schedule")
     */
    public function indexAction()
    {
        $scheduleList = [
            [
                "date" => "2020年11月1日",
                "time" => "12:00",
                "place" => "群馬",
            ],
            [
                "date" => "2020年11月2日",
                "time" => "13:30",
                "place" => "横浜",
            ],
            [
                "date" => "2020年11月3日",
                "time" => "18:00",
                "place" => "東京",
            ],
        ];
        return $this->render('AppBundle:Scedule:index.html.twig',
            ['scheduleList' => $scheduleList]
        );
    }
}
{% extends "::base.html.twig" %}

{% block title %}AppBundle:Scedule:index{% endblock %}

{% block body %}
<h1>Game Date</h1>
    <ul>
    {% for schedule in scheduleList %}
        <li>{{ schedule.date }} {{ schedule.time }} {{ schedule.place }}</li>
    {% endfor %}
    </ul>
{% endblock %}

Symfony2.8 リンク作成

2020年10月23日 Posted by PURGE

<a href="{{ path("app_member_index") }}">Member Page</a>

今更 symfony2.8 をインストール

2020年10月21日 Posted by PURGE

プロジェクト作成

$ php composer.phar create-project symfony/framework-standard-edition project-name "2.8.*"

サーバ起動

$ php app/console server:start

コントローラ作成

$ php app/console generate:controller