public function executeSaveTeamNote(sfWebRequest $request) { $note = $request->getParameter('note'); $a_role = RolePeer::getByTitle('Admin'); $id = $a_role->getId(); # validate //$c = new Criteria(); //$c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId()); //$c->add(PersonRolePeer::ROLE_ID, $id); //if (PersonRolePeer::doCount($c) == 0) $this->forward404(); # save $team_note = TeamNotePeer::retrieveByPK($id); if (!$team_note) { $team_note = new TeamNote(); } $team_note->setRoleId($id); $team_note->setNote(strip_tags($note, sfConfig::get('app_allowed_note_tags'))); $team_note->save(); return sfView::NONE; }
/** * Sets a single TeamNote object as related to this object by a one-to-one relationship. * * @param TeamNote $l TeamNote * @return Role The current object (for fluent API support) * @throws PropelException */ public function setTeamNote(TeamNote $v) { $this->singleTeamNote = $v; // Make sure that that the passed-in TeamNote isn't already associated with this object if ($v->getRole() === null) { $v->setRole($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 TeamNote $value A TeamNote object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(TeamNote $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getRoleId(); } // if key === null self::$instances[$key] = $obj; } }