/** * overrides the parent save function * */ public function save($con = null) { $saved = parent::save(); //update the credentials /** @var sfUser **/ $user = sfContext::getInstance()->getUser(); $userId = $user->getAttribute('subscriber_id', '', 'subscriber'); $agentUser = $this->getUserId(); if ($saved && $agentUser == $userId) { $user->setAgentCredentials(); } return $saved; }
/** * Returns a peer instance associated with this om. * * Since Peer classes are not to have any instance attributes, this method returns the * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. * * @return AgentHasUserPeer */ public function getPeer() { if (self::$peer === null) { self::$peer = new AgentHasUserPeer(); } return self::$peer; }