1
Symfony2 ile yaptığım projede, Doctrine createNativeQuery kullanıyorum ve ilişkisel bir dizi almak istiyorum. ResultSetMapping addScalarResult ilişkilendirici dizi
array:2 [
0 => array:4 [
"id" => "975"
"name" => "one name"
"phoneOne" => "122345556"
"phoneTwo" => "345566789"
]
1 => array:4 [
0 => array:4 [
"id" => "976"
"name" => "two name"
"phoneOne" => "122345556"
"phoneTwo" => "345566789"
]
]
Bu sonucun doktorunun var:
Bu benim bu sonucu var benim kod
$rsm = new ResultSetMapping;
$rsm->addScalarResult('id', 'id');
$rsm->addScalarResult('name', 'name');
$rsm->addScalarResult('phone_one', 'phoneOne');
$rsm->addScalarResult('phone_two', 'phoneTwo');
mı?
array:2 [
0 => array:4 [
"id" => "975"
"name" => "one name"
"phones" => [
"phoneOne" => "122345556"
"phoneTwo" => "345566789"
]
]
1 => array:4 [
0 => array:4 [
"id" => "976"
"name" => "two name"
"phones" => [
"phoneOne" => "122345556"
"phoneTwo" => "345566789"
]
]
]
Çok teşekkürler Telefonlar Kullanıcılar için bir OneToMany yaratmaz bu yüzden istediğiniz sonuç ise
Neden bu basit kümeyle yerel bir sorguya ihtiyacınız var? Gerçekten merak ediyorum. – Johnny
Tek bir sorguda çözmek istiyorum. :) –