public static function getFriendsMakover($subp_id, $puser_id) { $c = new Criteria(); $c->add(PuserRolePeer::SUBP_ID, $subp_id); $c->add(PuserRolePeer::PUSER_ID, $puser_id); $c->add(PuserRolePeer::ROLE, PuserRole::PUSER_ROLE_RECIPIENT); $puserRoles = PuserRolePeer::doSelectJoinkshow($c); if (!$puserRoles) { return array(0, null); } $kshow = $puserRoles[0]->getkshow(); $kshow_id = $kshow->getId(); // fetch the roughcut which is not the default roughcut $c = new Criteria(); $c->add(entryPeer::KSHOW_ID, $kshow_id); $c->add(entryPeer::TYPE, entryType::MIX); $c->add(entryPeer::ID, $kshow->getShowEntryId(), Criteria::NOT_EQUAL); $roughcut_entry = entryPeer::doSelectOne($c); return array($kshow_id, $roughcut_entry); }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this PuserKuser is new, it will return * an empty collection; or if this PuserKuser has previously * been saved, it will retrieve related PuserRolesRelatedByPuserId from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in PuserKuser. */ public function getPuserRolesRelatedByPuserIdJoinkshow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(PuserKuserPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPuserRolesRelatedByPuserId === null) { if ($this->isNew()) { $this->collPuserRolesRelatedByPuserId = array(); } else { $criteria->add(PuserRolePeer::PUSER_ID, $this->puser_id); $this->collPuserRolesRelatedByPuserId = PuserRolePeer::doSelectJoinkshow($criteria, $con, $join_behavior); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(PuserRolePeer::PUSER_ID, $this->puser_id); if (!isset($this->lastPuserRoleRelatedByPuserIdCriteria) || !$this->lastPuserRoleRelatedByPuserIdCriteria->equals($criteria)) { $this->collPuserRolesRelatedByPuserId = PuserRolePeer::doSelectJoinkshow($criteria, $con, $join_behavior); } } $this->lastPuserRoleRelatedByPuserIdCriteria = $criteria; return $this->collPuserRolesRelatedByPuserId; }