Hello!
I have for example 5 fields in database. For 3 of these i need column mapping but other two i don't need on ALL parts of my application.
Model:
namespace \Api\Models;
class Users extends \Phalcon\Mvc\Model
{
public $field1;
public $field2;
public $field3;
public function initialize()
{
$this->skipAttributes([
'field4',
'field5',
]);
}
public function columnMap()
{
return [
'field_no1' => 'field1',
'field_no2' => 'field2',
'field_no3' => 'field3',
];
}
}
In that case i have exception:
$user = Users::findFirst(42); // Phalcon\Mvc\Model\Exception: Column "field_no4" doesn't make part of the column map
So, my question is simple: how to skip fields in database in whole app?