/** * Jestli je parametr ke cteni nebo jen pro zapis * @param int MetaData::READ|MetaData::READWRITE * @param MetaData * @return MetaDataProperty $this */ protected function setAccess($access, MetaData $meta) { if ($access === NULL) { $access = MetaData::READWRITE; } if ($access === MetaData::WRITE) { throw new MetaDataException("Neni mozne vytvaret write-only polozky: {$this->class}::\${$this->name}"); } if (!in_array($access, array(MetaData::READ, MetaData::READWRITE), true)) { throw new MetaDataException(__CLASS__ . ' access is Orm\\MetaData::READ or Orm\\MetaData::READWRITE allowed'); } $methods = $meta->getMethods($this->name); if ($methods['is'] and $this->data['types'] === array('bool' => 'bool')) { $methods['get'] = $methods['is']; } $this->data['get'] = $access & MetaData::READ ? array('method' => $methods['get']) : NULL; $this->data['set'] = $access & MetaData::WRITE ? array('method' => $methods['set']) : NULL; return $this; }