/** * Set a value for the property * * Value can be either: * the full path to a file * the binary content of the file * * @param string $value */ public function setValue($value) { // @todo implement constraints if (substr($value, 0, 1) == DIRECTORY_SEPARATOR) { return $this->setValueFromFile($value); } else { return parent::setValue($value); } }
/** * Set a value for the property * * Value can be either: * an instance of the object designated in the 'instanceof' parameter * a data object if its getClass() method returns the same value as the 'instanceof' parameter * a t41_Object_Uri instance (loosely validated) * * @param object $value */ public function setValue($value) { if (is_string($value) && substr($value, 0, 1) == Backend::PREFIX) { $value = new ObjectUri($value); } $instanceof = $this->getParameter('instanceof'); if (!is_object($value) || !$value instanceof $instanceof && !$value instanceof DataObject && !$value instanceof ObjectUri) { $type = is_object($value) ? get_class($value) : gettype($value); throw new Exception(array("VALUE_MUST_BE_INSTANCEOF", array($this->getParameter('instanceof'), $value, $type, $this->_parent->getClass() . '::' . $this->_id))); } parent::setValue($value); }
public function setValue($value) { switch ($value) { case self::TODAY: $value = date('Y-m-d H:i:s'); break; case self::TOMORROW: $value = date('Y-m-d H:i:s', time() + 86400); break; case self::TODAY_DATE: $value = date('Y-m-d'); break; case self::TODAY_TIME: $value = date('H:i:s'); break; default: if ($this->getParameter('format') && !\Zend_Date::isDate($value, $this->getParameter('format'))) { throw new Exception(array("VALUE_NOT_A_DATE", array($this->_id, $value))); } break; } parent::setValue($value); }