public function getValues($suppressArrayNotation = false) { $values = parent::getValues($suppressArrayNotation); $tags = array(); foreach ($values as $key => $value) { if (preg_match('~^tag_(\\d+)$~', $key, $matches)) { if ($value == 1) { $tags[] = $this->_tagRepository->fetchEntity($matches[1]); } unset($values[$key]); } } $values['tags'] = $tags; return $values; }
public function getValue() { if ($this->isUploaded()) { // new id, if i always fetch a new entity for every upload if ($this->_value === null) { $this->_value = $this->_fileRepository->fetchNew(); } else { $this->_value->update = new \DateTime(); } $info = $this->getFileInfo(); $this->_value->name = $info[$this->_name]['name']; $this->_value->mimetype = $info[$this->_name]['type']; $this->_value->data = file_get_contents($info[$this->_name]['tmp_name']); $this->_value->size = $info[$this->_name]['size']; } else { if (isset($_FILES[$this->getName()])) { $this->_value = null; } } return $this->_value; }