Doctrine ORM : Undefined offset 2Good PHP ORM Library?PHP ORMs: Doctrine vs. PropelDoctrine - How to print out the real sql, not just the prepared statement?Default value in Doctrine“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHPCall to undefined function curl_init().?How to get specific column that is duplicated in Doctrine ORM?doctrine dql exception: Illegal offset type in /var/www/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php line 601Addition and Subtraction with Query Builder Doctrine ORM 2Use LIMIT and OFFSET with doctrines addSelect?

Do we have any particular tonal center in mind when we are NOT listening music?

Suffocation while cooking under an umbrella?

Reorder a matrix, twice

Why does the leading tone (G#) go to E rather than A in this example?

We are on WHV, my boyfriend was in a small collision, we are leaving in 2 weeks what happens if we don’t pay the damages?

New road bike: alloy dual pivot brakes work poorly

Youtube not blocked by iptables

How do you program Babbage's Difference Engine?

Subverting the emotional woman and stoic man trope

Lost Update Understanding

How can an attacker use robots.txt?

What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?

Do wheelchair-accessible aircraft exist?

Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?

Is it impolite to ask for an in-flight catalogue with no intention of buying?

My Project Manager does not accept carry-over in Scrum, Is that normal?

How to deal with a Homophobic PC

What did Jesse Pinkman mix into Walt's coffee?

Golf (6-card) Golf!

Why does my browser attempt to download pages from http://clhs.lisp.se instead of viewing them normally?

How 象【しょう】 ( ≈かたち、 すがた、ようす) and 象【ぞう】 (どうぶつ) got to be written with the same kanji?

Why did the Soviet Union not "grant" Inner Mongolia to Mongolia after World War Two?

Does wetting a beer glass change the foam characteristics?

What should I consider when deciding whether to delay an exam?



Doctrine ORM : Undefined offset 2


Good PHP ORM Library?PHP ORMs: Doctrine vs. PropelDoctrine - How to print out the real sql, not just the prepared statement?Default value in Doctrine“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHPCall to undefined function curl_init().?How to get specific column that is duplicated in Doctrine ORM?doctrine dql exception: Illegal offset type in /var/www/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php line 601Addition and Subtraction with Query Builder Doctrine ORM 2Use LIMIT and OFFSET with doctrines addSelect?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm working on a request to pick up some result from the database but I have an error and I don't know how to resove it



in my repository :



public function findBySearchField($salary, $contract, $experience, $training)

return $this->createQueryBuilder('a')
->andWhere('a.salary = :sal')
->setParameter('sal', $salary)
->andWhere('a.contract = :con')
->setParameter('con', $contract)
->andWhere('a.experience = :exp')
->setParameter('exp', $experience)
->andWhere('a.training = :tra')
->setParameter('tra', $training)
->orderBy('a.postedAt', 'DESC')
->getQuery()
->getResult()
;



in my controller :



public function index(Request $request, AdvertRepository $advertRepository): Response

$form = $this->createForm(ResearchType::class);
$form->handleRequest($request);

if ($request->getMethod() == 'POST')
$salary = $form->get('salary')->getData();
$contract = $form->get('contract')->getData();
$experience = $form->get('experience')->getData();
$training = $form->get('training')->getData();

return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findBySearchField(
['salary' => $salary],
['contract' => $contract],
['experience' => $experience],
['training' => $training]
),
]);


return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findAll(),
]);



I have an error "Notice: Undefined offset: 2"



However when I make this request in phpMyAdmin it returns what I am looking for










share|improve this question
























  • Hi Romain, I don't see any issue with the queries, how about your View files

    – ecarrizo
    Mar 28 at 17:24






  • 1





    "Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

    – AbraCadaver
    Mar 28 at 17:33












  • Hi ! I find the solution :

    – BanjoSf4
    Mar 29 at 16:47

















2















I'm working on a request to pick up some result from the database but I have an error and I don't know how to resove it



in my repository :



public function findBySearchField($salary, $contract, $experience, $training)

return $this->createQueryBuilder('a')
->andWhere('a.salary = :sal')
->setParameter('sal', $salary)
->andWhere('a.contract = :con')
->setParameter('con', $contract)
->andWhere('a.experience = :exp')
->setParameter('exp', $experience)
->andWhere('a.training = :tra')
->setParameter('tra', $training)
->orderBy('a.postedAt', 'DESC')
->getQuery()
->getResult()
;



in my controller :



public function index(Request $request, AdvertRepository $advertRepository): Response

$form = $this->createForm(ResearchType::class);
$form->handleRequest($request);

if ($request->getMethod() == 'POST')
$salary = $form->get('salary')->getData();
$contract = $form->get('contract')->getData();
$experience = $form->get('experience')->getData();
$training = $form->get('training')->getData();

return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findBySearchField(
['salary' => $salary],
['contract' => $contract],
['experience' => $experience],
['training' => $training]
),
]);


return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findAll(),
]);



I have an error "Notice: Undefined offset: 2"



However when I make this request in phpMyAdmin it returns what I am looking for










share|improve this question
























  • Hi Romain, I don't see any issue with the queries, how about your View files

    – ecarrizo
    Mar 28 at 17:24






  • 1





    "Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

    – AbraCadaver
    Mar 28 at 17:33












  • Hi ! I find the solution :

    – BanjoSf4
    Mar 29 at 16:47













2












2








2








I'm working on a request to pick up some result from the database but I have an error and I don't know how to resove it



in my repository :



public function findBySearchField($salary, $contract, $experience, $training)

return $this->createQueryBuilder('a')
->andWhere('a.salary = :sal')
->setParameter('sal', $salary)
->andWhere('a.contract = :con')
->setParameter('con', $contract)
->andWhere('a.experience = :exp')
->setParameter('exp', $experience)
->andWhere('a.training = :tra')
->setParameter('tra', $training)
->orderBy('a.postedAt', 'DESC')
->getQuery()
->getResult()
;



in my controller :



public function index(Request $request, AdvertRepository $advertRepository): Response

$form = $this->createForm(ResearchType::class);
$form->handleRequest($request);

if ($request->getMethod() == 'POST')
$salary = $form->get('salary')->getData();
$contract = $form->get('contract')->getData();
$experience = $form->get('experience')->getData();
$training = $form->get('training')->getData();

return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findBySearchField(
['salary' => $salary],
['contract' => $contract],
['experience' => $experience],
['training' => $training]
),
]);


return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findAll(),
]);



I have an error "Notice: Undefined offset: 2"



However when I make this request in phpMyAdmin it returns what I am looking for










share|improve this question














I'm working on a request to pick up some result from the database but I have an error and I don't know how to resove it



in my repository :



public function findBySearchField($salary, $contract, $experience, $training)

return $this->createQueryBuilder('a')
->andWhere('a.salary = :sal')
->setParameter('sal', $salary)
->andWhere('a.contract = :con')
->setParameter('con', $contract)
->andWhere('a.experience = :exp')
->setParameter('exp', $experience)
->andWhere('a.training = :tra')
->setParameter('tra', $training)
->orderBy('a.postedAt', 'DESC')
->getQuery()
->getResult()
;



in my controller :



public function index(Request $request, AdvertRepository $advertRepository): Response

$form = $this->createForm(ResearchType::class);
$form->handleRequest($request);

if ($request->getMethod() == 'POST')
$salary = $form->get('salary')->getData();
$contract = $form->get('contract')->getData();
$experience = $form->get('experience')->getData();
$training = $form->get('training')->getData();

return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findBySearchField(
['salary' => $salary],
['contract' => $contract],
['experience' => $experience],
['training' => $training]
),
]);


return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findAll(),
]);



I have an error "Notice: Undefined offset: 2"



However when I make this request in phpMyAdmin it returns what I am looking for







php doctrine-query






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 17:20









BanjoSf4BanjoSf4

274 bronze badges




274 bronze badges















  • Hi Romain, I don't see any issue with the queries, how about your View files

    – ecarrizo
    Mar 28 at 17:24






  • 1





    "Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

    – AbraCadaver
    Mar 28 at 17:33












  • Hi ! I find the solution :

    – BanjoSf4
    Mar 29 at 16:47

















  • Hi Romain, I don't see any issue with the queries, how about your View files

    – ecarrizo
    Mar 28 at 17:24






  • 1





    "Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

    – AbraCadaver
    Mar 28 at 17:33












  • Hi ! I find the solution :

    – BanjoSf4
    Mar 29 at 16:47
















Hi Romain, I don't see any issue with the queries, how about your View files

– ecarrizo
Mar 28 at 17:24





Hi Romain, I don't see any issue with the queries, how about your View files

– ecarrizo
Mar 28 at 17:24




1




1





"Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

– AbraCadaver
Mar 28 at 17:33






"Notice: Undefined offset: 2" What FILE and what LINE? Show that line.

– AbraCadaver
Mar 28 at 17:33














Hi ! I find the solution :

– BanjoSf4
Mar 29 at 16:47





Hi ! I find the solution :

– BanjoSf4
Mar 29 at 16:47












1 Answer
1






active

oldest

votes


















0
















thank you for your feedback,
I found the solution, in my method findBySearchField I gave arrays instead of giving variables.
This solution works :





 public function index(Request $request, AdvertRepository $advertRepository): Response

$form = $this->createForm(ResearchType::class);
$form->handleRequest($request);

if ($request->getMethod() == 'POST')
return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findBySearchField(
$salary = $form->get('salary')->getData(),
$contract = $form->get('contract')->getData(),
$experience = $form->get('experience')->getData(),
$training = $form->get('training')->getData()
),
]);


return $this->render('advert/index.html.twig', [
'form' => $form->createView(),
'adverts' => $advertRepository->findAll(),
]);








share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403512%2fdoctrine-orm-undefined-offset-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    thank you for your feedback,
    I found the solution, in my method findBySearchField I gave arrays instead of giving variables.
    This solution works :





     public function index(Request $request, AdvertRepository $advertRepository): Response

    $form = $this->createForm(ResearchType::class);
    $form->handleRequest($request);

    if ($request->getMethod() == 'POST')
    return $this->render('advert/index.html.twig', [
    'form' => $form->createView(),
    'adverts' => $advertRepository->findBySearchField(
    $salary = $form->get('salary')->getData(),
    $contract = $form->get('contract')->getData(),
    $experience = $form->get('experience')->getData(),
    $training = $form->get('training')->getData()
    ),
    ]);


    return $this->render('advert/index.html.twig', [
    'form' => $form->createView(),
    'adverts' => $advertRepository->findAll(),
    ]);








    share|improve this answer





























      0
















      thank you for your feedback,
      I found the solution, in my method findBySearchField I gave arrays instead of giving variables.
      This solution works :





       public function index(Request $request, AdvertRepository $advertRepository): Response

      $form = $this->createForm(ResearchType::class);
      $form->handleRequest($request);

      if ($request->getMethod() == 'POST')
      return $this->render('advert/index.html.twig', [
      'form' => $form->createView(),
      'adverts' => $advertRepository->findBySearchField(
      $salary = $form->get('salary')->getData(),
      $contract = $form->get('contract')->getData(),
      $experience = $form->get('experience')->getData(),
      $training = $form->get('training')->getData()
      ),
      ]);


      return $this->render('advert/index.html.twig', [
      'form' => $form->createView(),
      'adverts' => $advertRepository->findAll(),
      ]);








      share|improve this answer



























        0














        0










        0









        thank you for your feedback,
        I found the solution, in my method findBySearchField I gave arrays instead of giving variables.
        This solution works :





         public function index(Request $request, AdvertRepository $advertRepository): Response

        $form = $this->createForm(ResearchType::class);
        $form->handleRequest($request);

        if ($request->getMethod() == 'POST')
        return $this->render('advert/index.html.twig', [
        'form' => $form->createView(),
        'adverts' => $advertRepository->findBySearchField(
        $salary = $form->get('salary')->getData(),
        $contract = $form->get('contract')->getData(),
        $experience = $form->get('experience')->getData(),
        $training = $form->get('training')->getData()
        ),
        ]);


        return $this->render('advert/index.html.twig', [
        'form' => $form->createView(),
        'adverts' => $advertRepository->findAll(),
        ]);








        share|improve this answer













        thank you for your feedback,
        I found the solution, in my method findBySearchField I gave arrays instead of giving variables.
        This solution works :





         public function index(Request $request, AdvertRepository $advertRepository): Response

        $form = $this->createForm(ResearchType::class);
        $form->handleRequest($request);

        if ($request->getMethod() == 'POST')
        return $this->render('advert/index.html.twig', [
        'form' => $form->createView(),
        'adverts' => $advertRepository->findBySearchField(
        $salary = $form->get('salary')->getData(),
        $contract = $form->get('contract')->getData(),
        $experience = $form->get('experience')->getData(),
        $training = $form->get('training')->getData()
        ),
        ]);


        return $this->render('advert/index.html.twig', [
        'form' => $form->createView(),
        'adverts' => $advertRepository->findAll(),
        ]);









        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 29 at 16:53









        BanjoSf4BanjoSf4

        274 bronze badges




        274 bronze badges

































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403512%2fdoctrine-orm-undefined-offset-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해