/** * DOCUMENT ME * @param mixed $values * @return mixed */ public function updateObject($values = null) { $object = parent::updateObject($values); // Do some postvalidation of what parent::updateObject did // (it would be nice to turn this into an sfValidator subclass) $object->setDescription(aHtml::simplify($object->getDescription(), "<p><br><b><i><strong><em><ul><li><ol><a>")); // The tags field is not a native Doctrine field // so we can't rely on parent::updateObject to sort out // whether to use $values or $this->getValue. So we need // to sanitize and figure out what set of values to use // (embedded forms get a $values parameter, non-embedded // use $this->values) if (is_null($values)) { $values = $this->values; } // Slashes break routes in most server configs. Do NOT force case of tags. $values['tags'] = str_replace('/', '-', isset($values['tags']) ? $values['tags'] : ''); $object->setTags($values['tags']); return $object; }
public function updateObject($values = null) { $object = parent::updateObject($values); // Do some postvalidation of what parent::updateObject did // (it would be nice to turn this into an sfValidator subclass) $object->setDescription(aHtml::simplify($object->getDescription(), "<p><br><b><i><strong><em><ul><li><ol><a>")); // The tags field is not a native Doctrine field // so we can't rely on parent::updateObject to sort out // whether to use $values or $this->getValue. So we need // to sanitize and figure out what set of values to use // (embedded forms get a $values parameter, non-embedded // use $this->values) if (is_null($values)) { $values = $this->values; } // Now we're ready to play // We like all-lowercase tags for consistency $values['tags'] = strtolower($values['tags']); $object->setTags($values['tags']); $object->setOwnerId(sfContext::getInstance()->getUser()->getGuardUser()->getId()); return $object; }