retrieve data from an array in SymofnyHow do you check if an object exists in the Twig templating engine in Symfony2?Doctrine find() returning controllerDoctrine2 Cache Corruption?Create doctrine query in DoctrineODMMongoDBDocumentRepositoryGetting blob type Doctrine entity property returns data only onceHow do I hydrate and Entity with extra datagetting the gps location from the DB in symfony2 using controllerRetrieving node class data from returned PHPCR collections in Symfony CMFReturning multiple columns in doctrineHow to use Doctrine Criteria to filter out array properties?

Riley Rebuses that Share a Common Theme

When and what was the first 3D acceleration device ever released?

General purpose replacement for enum with FlagsAttribute

What are these (utility?) boxes at the side of the house?

Is using the CH340G on a commercial product a horrible idea?

Smart people send dumb people to a new planet on a space craft that crashes into a body of water

How to plot an unstable attractor?

Is there an evolutionary advantage to having two heads?

What are the benefits of cryosleep?

How bitcoin nodes update UTXO set when their latests blocks are replaced?

How does an ARM MCU run faster than the external crystal?

Which one below is grammatically correct?

How strong are Wi-Fi signals?

Can you heal a summoned creature?

Plot twist where the antagonist wins

Why do airplanes use an axial flow jet engine instead of a more compact centrifugal jet engine?

Tabulated absorption spectra of greenhouse gases?

Which noble houses were destroyed during the Game of Thrones?

Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?

Employer asking for online access to bank account - Is this a scam?

1960s sci-fi novella with a character who is treated as invisible by being ignored

Full horizontal justification in table

How many chess players are over 2500 Elo?

Identifying an object pointer by generating and using a unique ID



retrieve data from an array in Symofny


How do you check if an object exists in the Twig templating engine in Symfony2?Doctrine find() returning controllerDoctrine2 Cache Corruption?Create doctrine query in DoctrineODMMongoDBDocumentRepositoryGetting blob type Doctrine entity property returns data only onceHow do I hydrate and Entity with extra datagetting the gps location from the DB in symfony2 using controllerRetrieving node class data from returned PHPCR collections in Symfony CMFReturning multiple columns in doctrineHow to use Doctrine Criteria to filter out array properties?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















i have a method that actually it returns an array



class PanierRepository extends EntityRepository

public function findAllOrderedByName($iduser)


return $this->getEntityManager()
->createQuery(
'SELECT p FROM techeventBundle:Panier p WHERE p.userid = :iduser'
)->setParameter('iduser',$iduser)
->getResult();




i thought that method will return an object 'Panier' but i noticed that when i call it in my controller it's returning an array (because i got this error : spl_object_hash() expects parameter 1 to be object, array given ) and i cannot retrieve it's data , this is the code :



 $panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
//here i am trying to get data from the array but it's not working it's displaying an error Notice: Undefined offset: 0 //
$id = panier[0];


i have 2 questions :
1. how can i change the return type of the 'indAllOrderedByName'method to an object 'Panier' ?
2. if i cannot change the return type is there a solution to get the data from the returned array ?










share|improve this question






















  • hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

    – YassinovTrabajaa
    Mar 24 at 7:55






  • 1





    Glad you could solve it. I will vote to close as the question no longer needs to be up.

    – dbrumann
    Mar 24 at 7:57

















0















i have a method that actually it returns an array



class PanierRepository extends EntityRepository

public function findAllOrderedByName($iduser)


return $this->getEntityManager()
->createQuery(
'SELECT p FROM techeventBundle:Panier p WHERE p.userid = :iduser'
)->setParameter('iduser',$iduser)
->getResult();




i thought that method will return an object 'Panier' but i noticed that when i call it in my controller it's returning an array (because i got this error : spl_object_hash() expects parameter 1 to be object, array given ) and i cannot retrieve it's data , this is the code :



 $panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
//here i am trying to get data from the array but it's not working it's displaying an error Notice: Undefined offset: 0 //
$id = panier[0];


i have 2 questions :
1. how can i change the return type of the 'indAllOrderedByName'method to an object 'Panier' ?
2. if i cannot change the return type is there a solution to get the data from the returned array ?










share|improve this question






















  • hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

    – YassinovTrabajaa
    Mar 24 at 7:55






  • 1





    Glad you could solve it. I will vote to close as the question no longer needs to be up.

    – dbrumann
    Mar 24 at 7:57













0












0








0


0






i have a method that actually it returns an array



class PanierRepository extends EntityRepository

public function findAllOrderedByName($iduser)


return $this->getEntityManager()
->createQuery(
'SELECT p FROM techeventBundle:Panier p WHERE p.userid = :iduser'
)->setParameter('iduser',$iduser)
->getResult();




i thought that method will return an object 'Panier' but i noticed that when i call it in my controller it's returning an array (because i got this error : spl_object_hash() expects parameter 1 to be object, array given ) and i cannot retrieve it's data , this is the code :



 $panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
//here i am trying to get data from the array but it's not working it's displaying an error Notice: Undefined offset: 0 //
$id = panier[0];


i have 2 questions :
1. how can i change the return type of the 'indAllOrderedByName'method to an object 'Panier' ?
2. if i cannot change the return type is there a solution to get the data from the returned array ?










share|improve this question














i have a method that actually it returns an array



class PanierRepository extends EntityRepository

public function findAllOrderedByName($iduser)


return $this->getEntityManager()
->createQuery(
'SELECT p FROM techeventBundle:Panier p WHERE p.userid = :iduser'
)->setParameter('iduser',$iduser)
->getResult();




i thought that method will return an object 'Panier' but i noticed that when i call it in my controller it's returning an array (because i got this error : spl_object_hash() expects parameter 1 to be object, array given ) and i cannot retrieve it's data , this is the code :



 $panier = $this->getDoctrine()
->getManager()
->getRepository('techeventBundle:Panier')
->findAllOrderedByName($iduser);
//here i am trying to get data from the array but it's not working it's displaying an error Notice: Undefined offset: 0 //
$id = panier[0];


i have 2 questions :
1. how can i change the return type of the 'indAllOrderedByName'method to an object 'Panier' ?
2. if i cannot change the return type is there a solution to get the data from the returned array ?







symfony doctrine






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 7:41









YassinovTrabajaaYassinovTrabajaa

238




238












  • hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

    – YassinovTrabajaa
    Mar 24 at 7:55






  • 1





    Glad you could solve it. I will vote to close as the question no longer needs to be up.

    – dbrumann
    Mar 24 at 7:57

















  • hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

    – YassinovTrabajaa
    Mar 24 at 7:55






  • 1





    Glad you could solve it. I will vote to close as the question no longer needs to be up.

    – dbrumann
    Mar 24 at 7:57
















hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

– YassinovTrabajaa
Mar 24 at 7:55





hey guys i solved the problem , the getResult method returns an array of objects if you just need to return one object you can use getOneOrNullResult() or getSingleResult() they return one single object

– YassinovTrabajaa
Mar 24 at 7:55




1




1





Glad you could solve it. I will vote to close as the question no longer needs to be up.

– dbrumann
Mar 24 at 7:57





Glad you could solve it. I will vote to close as the question no longer needs to be up.

– dbrumann
Mar 24 at 7:57












0






active

oldest

votes












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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321673%2fretrieve-data-from-an-array-in-symofny%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f55321673%2fretrieve-data-from-an-array-in-symofny%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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

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

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현