Example #1
0
 /**
  * Sets a value for the key
  * @param string $key
  * @param mixed $val
  * @param bool $direct
  * @throws \Jazz\Model\Exception\CreateOnly
  */
 protected function _set(string $key, $val, bool $direct = false)
 {
     $structure = $this->structure();
     if (!$this->_isPopulating()) {
         $structure = $this->structure();
         if ($structure->isReadOnly($key)) {
             require_once 'Jazz/Model/Exception/ReadOnly.php';
             throw new \Jazz\Model\Exception\ReadOnly($key);
         }
         if ($this->isLoaded() && $structure->isCreateOnly($key)) {
             require_once 'Jazz/Model/Exception/CreateOnly.php';
             throw new \Jazz\Model\Exception\CreateOnly($key);
         }
     }
     parent::_set($key, $val, $direct);
     if ($direct === null) {
         $this->_dataDirty[$key] = $val;
     }
 }