I'm following the tutorial from zf2 website and at one point they create some properties:
namespace Album\Model;
class Album
{
public $id;
public $artist;
public $title;
public function exchangeArray($data)
{
$this->id = (isset($data['id'])) ? $data['id'] : null;
$this->artist = (isset($data['artist'])) ? $data['artist'] : null;
$this->title = (isset($data['title'])) ? $data['title'] : null;
}
}
they are public
and if i make them protected
then when i use them in my query i get an error saying that i can access them:
cannot access protected property Album\Model\Album::$artist
How can i keep them protected
and access them in the Model Table (or Mapper)?
Any ideas?