Example #1
0
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     PcTaskPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new PcTaskPeer();
     }
     return self::$peer;
 }
Example #2
0
 /**
  * @Overriding
  * 
  * We have to trim nicely in the case the list of tagIds is longer than the db
  * allows in order not to have truncated Ids.
  * 
  * @param      string $v new value - comma separated list of Ids
  * @return     PcTask The current object (for fluent API support)
  */
 public function setContexts($v)
 {
     // sorting
     $vArray = explode(',', $v);
     sort($vArray);
     $v = implode(',', $vArray);
     // truncating if necessary to fit into the db
     $contextsFieldLength = Propel::getDatabaseMap()->getColumn(PcTaskPeer::CONTEXTS)->getSize();
     if ($contextsFieldLength && strlen($v) > $contextsFieldLength) {
         $v = substr($v, 0, $contextsFieldLength);
         if (substr($v, -1) == ',') {
             // last character is a comma
             $v = substr($v, 0, $contextsFieldLength - 1);
         } else {
             // removing all the last digit because they probably are a truncated id
             $v = explode(',', $v);
             array_pop($v);
             $v = implode(',', $v);
         }
     }
     parent::setContexts($v);
     return $this;
 }