W
W
wolverine7772019-04-18 13:32:26
symfony
wolverine777, 2019-04-18 13:32:26

How to "throw" data from one function to another in symfony 4?

Hey!
It is necessary for me that the data that I enter into form 1, when passing from one function to another (and, accordingly, to another twig), is saved and appears in a new form (form 2).
Without introducing variables, this is easy - you need to create an empty entity object and fill it with set.
I tried to do it with $_POST but that's probably not how it's done...
Any advice would be appreciated..
Thank you!
(sorry if I'm wrong in terms - I'm new to symfony)

$value=$_POST; // это то, что не работает
  $post = new Site();
  $post->setTitle($value['title']);
  $post->setDescription($value['description']);


        $post = new Site();       // это то, что работает :)

        $post->setTitle('blabla TITLE ');
        $post->setDescription('blabla DESCRIPTION ');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question