我是symfony的初学者,我有一个问题引导程序表单主题。
应用程序/配置/ config.yml
if ("request_response".equals(type)) { sendNotification("You have a response to your request", "Response Available", HomeActivity.class); if (!BaseApp.isActivityVisible()){ sendNotification("You have a response to your request", "Response Available", HomeActivity.class); } else { //process data }
我已经确认它是四个空格标识。
我的控制器
<?php
namespace GR\SupervisorBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use GR\SupervisorBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;;
class SupervisorController extends Controller
{
public function indexAction()
{
return $this->render('GRSupervisorBundle:Supervisor:index.html.twig');
}
public function signInAction(Request $request)
{
//User creation
$user = new User();
//Connexion form creation
$formBuilder = $this->get('form.factory')->createBuilder(FormType::class, $user);
//Add entity fields to form
$formBuilder
->add('userName', TextType::class)
->add('password', PasswordType::class)
->add('signIn', SubmitType::class)
;
$form = $formBuilder->getForm();
return $this->render('GRSupervisorBundle:Supervisor:signIn.html.twig', array(
'form' => $form->createView(),
));
}
}
layout.html.twig
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Gornac.com{% endblock %}</title>
</head>
<body>
<!-- Body block -->
{% block body %} Hello World {% endblock %}
</body>
</html>
signIn.html.twig
{% extends "GRSupervisorBundle:Supervisor:layout.html.twig" %}
{% block title %}
Connexion - {{ parent() }}
{% endblock %}
{% block body %}
<h1> Connexion au superviseur </h1>
{{ include("GRSupervisorBundle:Supervisor:form.html.twig") }}
{% endblock %}
form.html.twig
<div class="well">
{{ form(form) }}
</div>
结果:screen
它对我不起作用......
感谢您的帮助