I want to have separate row for each related object in CGridView.
ModelB has modelAId, so it is HAS_MANY relationship.
The following query returns what I am trying to get:
select * from modelA a
join modelB b on b.modelAId = a.id
Here I am getting separate rows for each corresponding modelB row, records from modelA may be duplicated.
However, The following provider is not returning expected records, how can I make use of this in CActiveDataProvider
$provider = new CActiveDataProvider ("ModelA", array ("criteria" => array (
"with" => array("ModelB")
)
));
If I add join "join" => " join modelB b on b.modelAId = t.id", and remove with() it is giving correct records, but when I include with() it only gives modelA records.
What is the correct way of getting data from ModelA INCLUDING separate rows for ModelB relation?