public function getParentRecurs($relate = array()) { $relate[] = $this->getId(); $parent = VPayerTypePeer::retrieveByPk($this->getParent()); if ($parent) { $relate = $parent->getParentRecurs($relate); } return $relate; }
public static function getParents() { $parents = array(); foreach (VPayerTypePeer::doSelect(new Criteria()) as $d) { if (count($d->getPayerTypesRelatedByParent()) > 0) { $parents[] = $d->getId(); } } return $parents; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VPayerTypePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCode($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setDescription($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setParent($arr[$keys[3]]); } }
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(VPayerTypePeer::ID, $pks, Criteria::IN); $objs = VPayerTypePeer::doSelect($criteria, $con); } return $objs; }
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con) { $affectedRows = 0; $objects = PayerTypePeer::doSelect($criteria, $con); foreach ($objects as $obj) { include_once 'lib/model/VPayerType.php'; $c = new Criteria(); $c->add(VPayerTypePeer::PARENT, $obj->getId()); $affectedRows += VPayerTypePeer::doDelete($c, $con); } return $affectedRows; }
public function countVPayerTypes($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseVPayerTypePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(VPayerTypePeer::PARENT, $this->getId()); return VPayerTypePeer::doCount($criteria, $distinct, $con); }