public function executePersonalNotepad(sfWebRequest $request) { $note = PersonalNotePeer::retrieveByPK($this->getUser()->getId()); if (!$note instanceof PersonalNote) { $note = new PersonalNote(); $note->setPersonId($this->getUser()->getId()); $note->save(); } $this->note = $note; $this->allowed_tags = $this->getAllowedTags(); }
/** * Sets a single PersonalNote object as related to this object by a one-to-one relationship. * * @param PersonalNote $l PersonalNote * @return Person The current object (for fluent API support) * @throws PropelException */ public function setPersonalNote(PersonalNote $v) { $this->singlePersonalNote = $v; // Make sure that that the passed-in PersonalNote isn't already associated with this object if ($v->getPerson() === null) { $v->setPerson($this); } return $this; }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param PersonalNote $value A PersonalNote object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(PersonalNote $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getPersonId(); } // if key === null self::$instances[$key] = $obj; } }
public function executeSavePersonalNote(sfWebRequest $request) { $note = $request->getParameter('note'); $personal_note = PersonalNotePeer::retrieveByPK($this->getUser()->getId()); if (!$personal_note instanceof PersonalNote) { $personal_note = new PersonalNote(); $personal_note->setPersonId($this->getUser()->getId()); } $personal_note->setNote(strip_tags($note, sfConfig::get('app_allowed_note_tags'))); $personal_note->save(); return sfView::NONE; }