Symfony 3.4 : Repository method not foundExtend / Customize a doctrine's entity repository in symfonyError showing when using Custom repository in Symfony 2?EntityRepository not foundSymfony2 custom repository classHow to call doctrine in an entity class using symfonySymfony DQL query in repositoryUndefined method The method name must start with either findBy or findOneBySymfony Doctrine custom repository method not visibleError in symfony while inserting in BDD with doctrinesymfony 3.4 data fixture
Is presenting a play showing Military charactes in a bad light a crime in the US?
Very serious stuff - Salesforce bug enabled "Modify All"
"File type Zip archive (application/zip) is not supported" when opening a .pdf file
How to choose the correct exposure for flower photography?
Character had a different name in the past. Which name should I use in a flashback?
Does the Aboleth have expertise in history and perception?
Why does snapping your fingers activate the Infinity Gauntlet?
Find the values of U, V, C based on the given relationship...useful for upcoming puzzles
Why did Nick Fury not hesitate in blowing up the plane he thought was carrying a nuke?
Is it wise to pay off mortgage with 401k?
What does it mean for a program to be 32 or 64 bit?
Can a problematic AL DM/organizer prevent me from running a separate AL-legal game at the same store?
Have the writers and actors of Game Of Thrones responded to its poor reception?
On a piano, are the effects of holding notes and the sustain pedal the same for a single chord?
How can sister protect herself from impulse purchases with a credit card?
Why does Taylor’s series “work”?
Would a "ring language" be possible?
How to fix "webpack Dev Server Invalid Options" in Vuejs
How could the B-29 bomber back up under its own power?
Why are stats in Angband written as 18/** instead of 19, 20...?
Bash Read: Reading comma separated list, last element is missed
Why favour the standard WP loop over iterating over (new WP_Query())->get_posts()?
Pedaling at different gear ratios on flat terrain: what's the point?
What should I wear to go and sign an employment contract?
Symfony 3.4 : Repository method not found
Extend / Customize a doctrine's entity repository in symfonyError showing when using Custom repository in Symfony 2?EntityRepository not foundSymfony2 custom repository classHow to call doctrine in an entity class using symfonySymfony DQL query in repositoryUndefined method The method name must start with either findBy or findOneBySymfony Doctrine custom repository method not visibleError in symfony while inserting in BDD with doctrinesymfony 3.4 data fixture
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
i want to add a method in my repository class ;
this is my repository class 'PanierRepository' :
( path : src/techeventBundle/Repository/PanierRepository.php )
namespace techeventBundleRepository;
use DoctrineORMEntityRepository;
class PanierRepository extends EntityRepository
public function findAllOrderedByName($iduser)
and this is my entity class called 'Panier' :
(Path:src/techeventBundle/Entity/Panier.php)
namespace techeventBundleEntity;
use DoctrineORMMapping as ORM;
/**
* Panier
*
* @ORMTable(name="panier", indexes=@ORMIndex(name="userid", columns="userid"))
* @ORMEntity(repositoryClass="techeventBundleRepositoryPanierRepository")
*/
class Panier
{
and this is where i want to call this repository method , in a controller of another bundle and i have already included the entity (use techeventBundleEntityPanier;) :
(Path : src/reservationBundle/Controller/DefaultController.php)
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->findAllOrderedByName($iduser);
the repository method when i call it is not found !
Notice : i haven't generated the entities after adding the repository
please help and thanks !
symfony orm doctrine entity
add a comment |
i want to add a method in my repository class ;
this is my repository class 'PanierRepository' :
( path : src/techeventBundle/Repository/PanierRepository.php )
namespace techeventBundleRepository;
use DoctrineORMEntityRepository;
class PanierRepository extends EntityRepository
public function findAllOrderedByName($iduser)
and this is my entity class called 'Panier' :
(Path:src/techeventBundle/Entity/Panier.php)
namespace techeventBundleEntity;
use DoctrineORMMapping as ORM;
/**
* Panier
*
* @ORMTable(name="panier", indexes=@ORMIndex(name="userid", columns="userid"))
* @ORMEntity(repositoryClass="techeventBundleRepositoryPanierRepository")
*/
class Panier
{
and this is where i want to call this repository method , in a controller of another bundle and i have already included the entity (use techeventBundleEntityPanier;) :
(Path : src/reservationBundle/Controller/DefaultController.php)
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->findAllOrderedByName($iduser);
the repository method when i call it is not found !
Notice : i haven't generated the entities after adding the repository
please help and thanks !
symfony orm doctrine entity
Check first that you don't get a null object when using$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12
add a comment |
i want to add a method in my repository class ;
this is my repository class 'PanierRepository' :
( path : src/techeventBundle/Repository/PanierRepository.php )
namespace techeventBundleRepository;
use DoctrineORMEntityRepository;
class PanierRepository extends EntityRepository
public function findAllOrderedByName($iduser)
and this is my entity class called 'Panier' :
(Path:src/techeventBundle/Entity/Panier.php)
namespace techeventBundleEntity;
use DoctrineORMMapping as ORM;
/**
* Panier
*
* @ORMTable(name="panier", indexes=@ORMIndex(name="userid", columns="userid"))
* @ORMEntity(repositoryClass="techeventBundleRepositoryPanierRepository")
*/
class Panier
{
and this is where i want to call this repository method , in a controller of another bundle and i have already included the entity (use techeventBundleEntityPanier;) :
(Path : src/reservationBundle/Controller/DefaultController.php)
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->findAllOrderedByName($iduser);
the repository method when i call it is not found !
Notice : i haven't generated the entities after adding the repository
please help and thanks !
symfony orm doctrine entity
i want to add a method in my repository class ;
this is my repository class 'PanierRepository' :
( path : src/techeventBundle/Repository/PanierRepository.php )
namespace techeventBundleRepository;
use DoctrineORMEntityRepository;
class PanierRepository extends EntityRepository
public function findAllOrderedByName($iduser)
and this is my entity class called 'Panier' :
(Path:src/techeventBundle/Entity/Panier.php)
namespace techeventBundleEntity;
use DoctrineORMMapping as ORM;
/**
* Panier
*
* @ORMTable(name="panier", indexes=@ORMIndex(name="userid", columns="userid"))
* @ORMEntity(repositoryClass="techeventBundleRepositoryPanierRepository")
*/
class Panier
{
and this is where i want to call this repository method , in a controller of another bundle and i have already included the entity (use techeventBundleEntityPanier;) :
(Path : src/reservationBundle/Controller/DefaultController.php)
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->findAllOrderedByName($iduser);
the repository method when i call it is not found !
Notice : i haven't generated the entities after adding the repository
please help and thanks !
symfony orm doctrine entity
symfony orm doctrine entity
asked Mar 23 at 18:34
YassinovTrabajaaYassinovTrabajaa
238
238
Check first that you don't get a null object when using$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12
add a comment |
Check first that you don't get a null object when using$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12
Check first that you don't get a null object when using
$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
Check first that you don't get a null object when using
$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12
add a comment |
1 Answer
1
active
oldest
votes
Try with:
$this->getDoctrine()->getManager()->getRepostory( ...
finally, ... your code should be:
$panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
or
$panier = $this->getDoctrine()
->getManager()
->getRepository(techeventBundleEntityPanier::class)
->findAllOrderedByName($iduser);
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
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/3.0/"u003ecc by-sa 3.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%2f55317104%2fsymfony-3-4-repository-method-not-found%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
Try with:
$this->getDoctrine()->getManager()->getRepostory( ...
finally, ... your code should be:
$panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
or
$panier = $this->getDoctrine()
->getManager()
->getRepository(techeventBundleEntityPanier::class)
->findAllOrderedByName($iduser);
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
add a comment |
Try with:
$this->getDoctrine()->getManager()->getRepostory( ...
finally, ... your code should be:
$panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
or
$panier = $this->getDoctrine()
->getManager()
->getRepository(techeventBundleEntityPanier::class)
->findAllOrderedByName($iduser);
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
add a comment |
Try with:
$this->getDoctrine()->getManager()->getRepostory( ...
finally, ... your code should be:
$panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
or
$panier = $this->getDoctrine()
->getManager()
->getRepository(techeventBundleEntityPanier::class)
->findAllOrderedByName($iduser);
Try with:
$this->getDoctrine()->getManager()->getRepostory( ...
finally, ... your code should be:
$panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
or
$panier = $this->getDoctrine()
->getManager()
->getRepository(techeventBundleEntityPanier::class)
->findAllOrderedByName($iduser);
edited Mar 24 at 0:21
answered Mar 23 at 20:02
sensorariosensorario
7,4781354105
7,4781354105
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
add a comment |
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The fairly new ... syntax in php is kinda cool but I don't think that is the problem here. And you are mssing the closing ) and semicolon.
– Cerad
Mar 23 at 20:11
The point is
->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
The point is
->getDoctrine()->getManager()
– sensorario
Mar 24 at 0:20
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
Please read the updated response with a screenshot from official documentation
– sensorario
Mar 24 at 0:22
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
@sensorario thanks for your answer it's working
– YassinovTrabajaa
Mar 24 at 4:18
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
Glad you got it working but I just wanted to point out that there is no difference between $this->getDoctrine()->getRepository and $this->getDoctrine()-getManager()>getRepository. At some point you fixed your repository mapping problem without realizing it.
– Cerad
Mar 24 at 14:09
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%2f55317104%2fsymfony-3-4-repository-method-not-found%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
Check first that you don't get a null object when using
$this->getDoctrine()->getRepository('techeventBundle:Panier');
– Tyr
Mar 23 at 18:37
$panier = $this->getDoctrine()->getRepository('techeventBundle:Panier')->find(1); is not displaying any error
– YassinovTrabajaa
Mar 23 at 18:43
It does not display an error for find because your are getting the default entity repository. Your entity is not properly mapped to the repository. Possibly because you have older generated mapping files under Resources/config/doctrine which interfere with the annotations.
– Cerad
Mar 23 at 20:10
@Cerad what's the solution ?
– YassinovTrabajaa
Mar 23 at 20:12