0
我正在用zend 2框架編寫應用程序。我沒有使用它,前一段時間做了小應用程序也許與zend 1.zend 2文檔中的公共實體屬性 - 它好嗎?
我看到什麼是不平常的我 - 公共財產。我認爲這很糟糕。但是Zend公司表示這樣的例子:
namespace Album\Model;
class Album
{
public $id;
public $artist;
public $title;
public function exchangeArray($data)
{
$this->id = (!empty($data['id'])) ? $data['id'] : null;
$this->artist = (!empty($data['artist'])) ? $data['artist'] : null;
$this->title = (!empty($data['title'])) ? $data['title'] : null;
}
}
https://framework.zend.com/manual/2.3/en/user-guide/database-and-models.html
是有利於這種情況?爲什麼?