コード例 #1
0
 public function delete($connection = null)
 {
     // Cascade delete descendants
     if (0 < count($children = $this->getChildren())) {
         foreach ($children as $child) {
             $child->delete($connection);
         }
     }
     // Delete relations
     $criteria = new Criteria();
     $cton1 = $criteria->getNewCriterion(QubitRelation::OBJECT_ID, $this->id);
     $cton2 = $criteria->getNewCriterion(QubitRelation::SUBJECT_ID, $this->id);
     $cton1->addOr($cton2);
     $criteria->add($cton1);
     if (0 < count($relations = QubitRelation::get($criteria))) {
         foreach ($relations as $relation) {
             $relation->delete($connection);
         }
     }
     // Delete relation to objects
     $criteria = new Criteria();
     $criteria->add(QubitObjectTermRelation::TERM_ID, $this->id);
     if (0 < count($otRelations = QubitObjectTermRelation::get($criteria))) {
         foreach ($otRelations as $otRelation) {
             $otRelation->delete($connection);
         }
     }
     parent::delete($connection);
 }
コード例 #2
0
ファイル: Term.php プロジェクト: ngdvan/lntguitar
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
コード例 #3
0
ファイル: BaseTerm.php プロジェクト: therealchiko/getchabooks
 /**
  * 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     TermPeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new TermPeer();
     }
     return self::$peer;
 }