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;
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
add a comment
|
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
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
add a comment
|
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
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
php doctrine-query
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
add a comment
|
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
add a comment
|
1 Answer
1
active
oldest
votes
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(),
]);
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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(),
]);
add a comment
|
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(),
]);
add a comment
|
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(),
]);
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(),
]);
answered Mar 29 at 16:53
BanjoSf4BanjoSf4
274 bronze badges
274 bronze badges
add a comment
|
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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