public function countSocialConnectionsRelatedByUser2Id($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseSocialConnectionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(SocialConnectionPeer::USER2_ID, $this->getId()); return SocialConnectionPeer::doCount($criteria, $distinct, $con); }
public function getAllPendingConnections() { $status = sfConfig::get('app_socon_status_pending'); return SocialConnectionPeer::retrieveByUserId($this->getUserId(), $status); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = SocialConnectionPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUuid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setUser1Id($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setUser2Id($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setNotes($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setStatus($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setUpdatedAt($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setDeletedAt($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setCreatedAt($arr[$keys[8]]); } }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(SocialConnectionPeer::ID, $pks, Criteria::IN); $objs = SocialConnectionPeer::doSelect($criteria, $con); } return $objs; }
public function executeRemoveConnection() { $socon = SocialConnectionPeer::retrieveByUuid($this->getRequestParameter('socon')); $this->forward404Unless($socon, "Socon not found, unable to remove"); $socon->setStatus(sfConfig::get('app_socon_status_declined')); $socon->save(); $other = $socon->getOtherUser($this->getUser()->getId()); $message = array(); $message["from"] = $this->getUser()->getId(); $message["to"] = $this->getUser()->getId(); $message["owner"] = $this->getUser()->getId(); $message["parent"] = null; $message["folder"] = "inbox"; $message["subject"] = "You have removed a social connection"; $message["text"] = 'You have removed your connection with ' . $other->getProfile() . '.'; $options = array(); MessagePeer::sendSimpleMessage($message, $options); $this->redirect('networks/index?tab=main'); }