I am working in YII2 Framework on the following query
SELECT T.id, T.name, T.status, IFNULL(T.image,'no-image.png') as DP
FROM TABLE_NAME T;
here is my code
$modelTeam = Teams::find()
->select(
['T.id', 'T.name', 'T.status', 'IFNULL(T.image,"no-image.png") as DP']
)
->from('{{%teams}} T')
->all();
Edit:
The result set does not include DP
column at all why is that so, and how can I do that.
Edit 2:
While telling that the results do not include the DP
column I missed a piece of important information that I was using the ArrayHelper::toArray()
to convert the model object to an array and then iterate over it
$results=ArrayHelper::toArray($modelTeam);