public function __construct($reader, $writer) { parent::__construct($reader, $writer); $data = $this->reader->get_data(); if (empty($data['id']) || !Check::id($data['id'])) { throw new Error_Update('Incorrect Id'); } $model = new Model_Post_Update($data['id']); $model->load(); if ($model->is_phantom()) { throw new Error_Update('Incorrect Id'); } $this->model = $model; }
public function __construct($reader, $writer) { parent::__construct($reader, $writer); $data = $this->reader->get_data(); if (empty($data['id']) || !Check::id($data['id'])) { throw new Error_Update('Incorrect Id'); } $model = new Model_Video($data['id']); $model->load(); if ($model->is_phantom()) { throw new Error_Update('Incorrect Id'); } if ($model['area'] != 'workshop' && !sets::user('rights')) { throw new Error_Update('Not enough rights'); } $this->model = $model; }