There is a class:
class VideoModel extends BaseModel { ... protected $youtubeId; protected function setYouTubeId($value) { if (!empty($value)) { $this->setUploadedAt(date('Ymd H:i:s')); $this->youtubeId = $value; return true; } return false; } } class BaseModel { ... public function __get($field) { // check if getter exists $getterName = 'get'.ucfirst($field); if (method_exists($this, $getterName)) { return $this->$getterName(); } if (isset($this->$field)) { return $this->$field; } return null; } }
This code does not work as expected:
>> var_dump($webinar->youtubeId); string 'rzCGzjbyQjc' (length=11) >> var_dump(empty($webinar->youtubeId)); boolean true
(isset($this->$field))
in the code I seeisset
and where do you checkempty
why? - Naumovif (!empty($webinar->youtubeId)) { include '_webinarPlayer.php'; } else { include '_waitForRecord.php'; }
). - Makarenko_I_Vvar_dump
right beforeif
what does it say? not in console xdebug - Naumov