W
W
wolverine7772019-05-09 17:08:45
symfony
wolverine777, 2019-05-09 17:08:45

Why doesn't Symfony see $_POST?

Hello,
I'm trying to create a button on a page that would organize a list of pages on the site in the order I need.
To do this, when creating a site, I first skip the stage that organizes the pages (since there are simply no pages) and then I try to make sure that if the pages are present on the site, then alignment by number would take place ..
For some reason, symfony does not see my $_POST in the second case. Please tell me how to be?
controller:

$pages=array();


    if($pages){
              if($_POST){
                    $em = $this->getDoctrine()->getManager();

                    $value = $_POST;

                    for ($i =0; isset(array_values($value)[$i]); $i++) {
                        if (array_values($value)[$i])
                        {
                            $Page = $this->getDoctrine()->getRepository(Page::class)->find(array_keys($value)[$i]);
                            if($value!=null)
                                $Page->setOrdre(array_values($value)[$i]);
                        }
                    }

                    $em->flush();
            }
        }


if(!$site)
    {
      $site= new Site();

    }
    else
    {
      if($pages=$this->getDoctrine()->getRepository(Page::class)->findBy(['idSite'=>$site->getIdSite()], array('ordre' => 'ASC')))
      {
      }

    }

twig button
<td align="right" colspan="3" style="width: 45px;">
                            <div style="float: right;">
                                <input type="image" src="/images/icones/order.gif" alt="Order" title="Order" >
                            </div>
                        </td>

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