I'm using getters and setters for my model classes and have private properties in underscore style, I haven't had a problem with that since Phalcon 2.0.x.
You could also play with the columnMap
definition.
class Language extends BaseModel
{
public function getSource() {
return 'language';
}
public function columnMap() {
return [
'id' => 'id',
'code' => 'code',
'name' => 'name',
'native_name' => 'native_name',
'is_enabled' => 'is_enabled',
];
}
/** @var int */
protected $id;
/**
* @param int $id
* @return $this
*/
public function setId($id) {
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getId() {
return $this->id;
}
/** @var string */
protected $code;
/**
* @param string $code
* @return $this
*/
public function setCode($code) {
$this->code = $code;
return $this;
}
/**
* @return string
*/
public function getCode() {
return $this->code;
}
/** @var string */
protected $name;
/**
* @param string $name
* @return $this
*/
public function setName($name) {
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getName() {
return $this->name;
}
/** @var string */
protected $native_name;
/**
* @param string $native_name
* @return $this
*/
public function setNativeName($native_name) {
$this->native_name = $native_name;
return $this;
}
/**
* @return string
*/
public function getNativeName() {
return $this->native_name;
}
/** @var bool */
protected $is_enabled;
/**
* @param bool $is_enabled
* @return $this
*/
public function setIsEnabled($is_enabled) {
$this->is_enabled = $is_enabled;
return $this;
}
/**
* @return bool
*/
public function getIsEnabled() {
return $this->is_enabled;
}
/**
* @return bool
*/
public function isEnabled() {
return $this->is_enabled;
}
}