/**
  * Get the associated Mensaje object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Mensaje The associated Mensaje object.
  * @throws     PropelException
  */
 public function getMensaje(PropelPDO $con = null)
 {
     if ($this->aMensaje === null && $this->id_mensaje !== null) {
         $c = new Criteria(MensajePeer::DATABASE_NAME);
         $c->add(MensajePeer::ID_MENSAJE, $this->id_mensaje);
         $this->aMensaje = MensajePeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aMensaje->addMensajeDestinos($this);
         		 */
     }
     return $this->aMensaje;
 }
예제 #2
0
 protected function getMensajeOrCreate($id_mensaje = 'id_mensaje')
 {
     $usuario_actual = Usuario::getUsuarioActual();
     if (!$this->getRequestParameter($id_mensaje)) {
         $mensaje = new Mensaje();
         $mensaje->setIdUsuario($usuario_actual->getPrimaryKey());
     } else {
         $c = new Criteria();
         $c->add(MensajePeer::ID_MENSAJE, $this->getRequestParameter($id_mensaje));
         $c->addAnd(MensajePeer::ID_USUARIO, $usuario_actual->getPrimaryKey());
         $mensaje = MensajePeer::doSelectOne($c);
         $this->forward404Unless($mensaje);
     }
     return $mensaje;
 }