Regarding https://github.com/phalcon/cphalcon/issues/14538 I've had the same issue that a database table column name was "source". By default I'm using protected properties a column map and public getter and setter methods to write my models, like:
<?php
namespace App\Models\Prod;
class OrdersLifecycle extends Base {
protected $id;
protected $orderId;
protected $orderState;
protected $changedDate;
public function initialize() {
$this->setSource('orders_lifecycle');
$this->belongsTo('orderId', 'App\Models\Prod\Orders', 'id', [ 'alias' => 'Order' ]);
}
public function columnMap() {
return [
'id' => 'id',
'order_id' => 'orderId',
'order_state' => 'orderState',
'changed_date' => 'changedDate',
];
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getOrderId() {
return $this->orderId;
}
public function setOrderId($orderId) {
$this->orderId = $orderId;
}
public function getOrderState() {
return $this->orderState;
}
public function setOrderState($orderState) {
$this->orderState = $orderState;
}
public function getChangedDate() {
return $this->changedDate;
}
public function setChangedDate($changedDate) {
$this->changedDate = $changedDate;
}
}
Is this the way to go or should I use public properties like "niden" suggest in Github issue?