public function getStatusId($status) { if (is_integer($status)) { return $status; } //is it a known text string $c = new \Criteria(); $c->add(\StatusPeer::DISPLAY_NAME, $status); $statusObj = \StatusPeer::doSelectOne($c); if (isset( $statusObj )) { return $statusObj->getId(); } else { return false; } }
/** * Get the associated Status object * * @param PropelPDO Optional Connection object. * @return Status The associated Status object. * @throws PropelException */ public function getStatus(PropelPDO $con = null) { if ($this->aStatus === null && $this->status_id !== null) { $c = new Criteria(StatusPeer::DATABASE_NAME); $c->add(StatusPeer::ID, $this->status_id); $this->aStatus = StatusPeer::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->aStatus->addProjects($this); */ } return $this->aStatus; }
/** * The default landing for project manager. * Lists all the active jobs. * * @param sfWebRequest $request */ public function executeList(sfWebRequest $request) { if ($this->getUser()->getProfile()) { $credential = $this->getUser()->getProfile()->getUserType()->getType(); $this->getUser()->addCredential($credential); } if (!$this->getUser()->hasCredential("admin")) { if ($this->getUser()->hasCredential("client")) { $url = $this->generateUrl("client_myjobs_own", array("own" => "true")); } else { if ($this->getUser()->hasCredential("photographer")) { $url = $this->generateUrl("client_myjobs_own"); } else { $this->redirect404(); } } $this->redirect($url); } if (!method_exists($this->getRoute(), "getObject")) { $c = new Criteria(); $c->add(StatusPeer::ID, sfConfig::get("app_project_list_default_view", 1)); $showType = StatusPeer::doSelectOne($c); } else { $showType = $this->getRoute()->getObject(); } $this->routeObject = $showType; $this->createCriteria($showType->getId(), array("route" => "job_list_by", "slugOn" => "state", "slug" => $this->routeObject)); }