Reputation: 2308
I want to get doctrin2 query result in object format but it gives me in array format. I tried but I can't succeed.
This is demo query but if I want to apply similar types of join in another query than also requires results in object format but in all of them.
Can you have any solution?
return $this->createQueryBuilder("u")
->select("u.id as userid, up.id as profileid, u.username, u.email, u.isactive, up.firstname, up.lastname, up.profileimage, up.address, up.zipcode, up.biography")
->innerjoin("u.userprofile", "up")
->where("u.id = :userid")
->setParameter(":userid", $userid)
->getQuery()
->getResult();
ResultSet :
Array
(
[userid] => 4
[profileid] => 3
[username] => Test user
[email] => [email protected]
[isactive] => 1
[firstname] => MyFname
[lastname] => MyLname
[profileimage] => 5111ea998c9476c2231180050d5ad64dc3298fe0.jpeg
[address] => My Address
[zipcode] => 36102555
[biography] => This is my first symfon2.3 project.
)
Upvotes: 2
Views: 2822