If you get this problem: Symfony 3 The CSRF token is invalid. Please try to resubmit the form

Solution 1 :

In your app/config/config.yml

change : save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
to : save_path: ~

Solution 2 :

Givive permissions :

mkdir -p var/sessions
chmod 755 var/sessions

For twig

base.html.twig :

<p{{ 'message'|trans }}</p>

Create or update your files translation :

# tempate from app/Resources
php bin/console translation:update --dump-messages --force fr
php bin/console translation:update --dump-messages --force en

# template from AppBundle/Resources
php bin/console translation:update --dump-messages --force fr AppBundle
php bin/console translation:update --dump-messages --force en AppBundle

 

You can use an “array” :

$to = array(
            "user1@gmail.com" => "User 1",
            "user2@gmail.com" => "User 2"
        );

 

Example :

$subject = "User";

        $to = array(
            "user1@gmail.com" => "User 1",
            "user2@gmail.com" => "User 2"
        );

        $from = "contact@become-developer.com";
        $name = "Become Developer";

        $body = "content";

$message = \Swift_Message::newInstance()
            ->setSubject($subject)
            ->setFrom($from)
            ->setTo($to)
            ->setBody($body)
            /*
             * If you also want to include a plaintext version of the message
            ->addPart(
                $this->renderView(
                    'Emails/registration.txt.twig',
                    array('name' => $name)
                ),
                'text/plain'
            )
            */
        ;

        // or, you can also fetch the mailer service this way
        // $this->get('mailer')->send($message);
        return $this->mailer->send($message);

 

This error appear because your type not a “Array”

 

Change type to “array”

    /**
     * @var string
     *
     * @ORM\Column(name="informations", type="array")
     * */
    private $informations;

Then update your database with Command Symfony

Tip :

var url = '{{ path("yourroute", {'id': 'id'}) }}'; 
url = url.replace("id", this.value);

window.location.href = url;

 

app.request.get('id')

 

Define the real entity:

 * @ORM\Entity

For example

Before :

<?php

namespace BookingBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="booking")
 */
class Booking
{

After :

<?php

namespace BookingBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="booking")
 */
class Booking
{

 

Il faut impérativement ajouter son bundle dans le fichier composer.json comme ceci par exemple

 

"autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle",
            "Acme\\Bundle\\BlogBundle\\": "src/Acme/Bundle/BlogBundle",
            "BlogBundle\\": "src/BlogBundle",
            "LangueBundle\\": "src/LangueBundle",
            "PaymentALBundle\\": "src/PaymentALBundle"

        },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },

Et puis exécuter cette commande :

composer dumpautoload

 

Create a database

php bin/console doctrine:database:create

Update database

php app/console doctrine:schema:update --force

Create a bundle

php bien/console generate:bundle

Create a entity

php bin/console generate:doctrine:entity

Crud entity

php bin/console generate:doctrine:crud

Cleach cache

php bin/console cache:warmup