sql - Give an alias to field name on ::find('all') -
i have field on database called name
when retrieve called label
.
in raw sql
can this:
select name label ...
theres "quick way" on find
without need deal entity
, virtual fields
etc...
i did using virtual properties on entity
:
protected $_virtual = ['label']; protected function _getlabel() { return $this->_properties['name']; }
a potential gotcha be... i'm using _serialize
return result , not working because have expose virtual properties using $_virtual
.
Comments
Post a Comment