shyandsy
(Shyandsy)
1
for the following code in my catagory model
// declare relation
public function getCatagoryDescription()
{
return $this->hasOne(OcCategoryDescription::className(), ['category_id' => 'category_id']);
}
public function getCategories($parent_id = 0)
{
$a = '${parent_id}';
$result = $this->find()->joinWith('catagoryDescription', true);
$result = $result->where('parent_id = ' . $parent_id . ' and status = 1');
$result = $result->orderBy('oc_category.sort_order, LCASE(oc_category_description.name)');
[color="#FF0000"][b]//$result = $result->asArray();[/b][/color]
$result = $result->all();
return $result;
}
if i do not use the asArray method, then I can’t get the related object
6053

if I add the code $result = $result->asArray();, then I can get the catagory description data.
6054

I haven’t find a good case to describe this, are there someone know the answer?
I appreciate it if it could be solved today…
more details: https://github.com/yiisoft/yii2/issues/5879
(I still have little problem on English, but I am getting better)
shyandsy
(Shyandsy)
2
still waiting online!!!////////////////////////
shyandsy
(Shyandsy)
3