Exemplo n.º 1
0
 public function getTagsString()
 {
     $c = new Criteria();
     $c->add(PcContactsTagsPeer::CONTACT_ID, $this->getId());
     $contactsTags = PcContactsTagsPeer::doSelect($c);
     $tagsString = '';
     foreach ($contactsTags as $contactTags) {
         $tag = PcContactTagPeer::retrieveByPK($contactTags->getTagId());
         $tagsString .= "@{$tag->getName()}, ";
     }
     return $tagsString;
 }
Exemplo n.º 2
0
 /**
  * Gets an array of PcContactsTags objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this PcContact has previously been saved, it will retrieve
  * related PcContactsTagss from storage. If this PcContact is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array PcContactsTags[]
  * @throws     PropelException
  */
 public function getPcContactsTagss($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PcContactPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPcContactsTagss === null) {
         if ($this->isNew()) {
             $this->collPcContactsTagss = array();
         } else {
             $criteria->add(PcContactsTagsPeer::CONTACT_ID, $this->id);
             PcContactsTagsPeer::addSelectColumns($criteria);
             $this->collPcContactsTagss = PcContactsTagsPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // 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(PcContactsTagsPeer::CONTACT_ID, $this->id);
             PcContactsTagsPeer::addSelectColumns($criteria);
             if (!isset($this->lastPcContactsTagsCriteria) || !$this->lastPcContactsTagsCriteria->equals($criteria)) {
                 $this->collPcContactsTagss = PcContactsTagsPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPcContactsTagsCriteria = $criteria;
     return $this->collPcContactsTagss;
 }
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $contact_id
  * @param      int $tag_id
  * @param      PropelPDO $con
  * @return     PcContactsTags
  */
 public static function retrieveByPK($contact_id, $tag_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $contact_id, (string) $tag_id));
     if (null !== ($obj = PcContactsTagsPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(PcContactsTagsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(PcContactsTagsPeer::DATABASE_NAME);
     $criteria->add(PcContactsTagsPeer::CONTACT_ID, $contact_id);
     $criteria->add(PcContactsTagsPeer::TAG_ID, $tag_id);
     $v = PcContactsTagsPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }