/** * Retrieves folder by relative path * * @param string $path * @param string $separator * @return sfAssetFolder */ public static function retrieveByPath($path = '', $separator = DIRECTORY_SEPARATOR) { $path = self::cleanPath($path); $c = new Criteria(); $c->add(sfAssetFolderPeer::RELATIVE_PATH, $path ? $path : null); return sfAssetFolderPeer::doSelectOne($c); }
/** * Gets immediate ancestor for the given node if it exists * * @param sfAssetFolder $node Propel object for src node * @param PropelPDO $con Connection to use. * @return mixed Propel object if exists else null */ public static function retrieveParent(NodeObject $node, PropelPDO $con = null) { $c = new Criteria(sfAssetFolderPeer::DATABASE_NAME); $c1 = $c->getNewCriterion(self::LEFT_COL, $node->getLeftValue(), Criteria::LESS_THAN); $c2 = $c->getNewCriterion(self::RIGHT_COL, $node->getRightValue(), Criteria::GREATER_THAN); $c1->addAnd($c2); $c->add($c1); if (self::SCOPE_COL) { $c->add(self::SCOPE_COL, $node->getScopeIdValue(), Criteria::EQUAL); } $c->addAscendingOrderByColumn(self::RIGHT_COL); $parent = sfAssetFolderPeer::doSelectOne($c, $con); $node->setParentNode($parent); return $parent; }
/** * Get the associated sfAssetFolder object * * @param PropelPDO Optional Connection object. * @return sfAssetFolder The associated sfAssetFolder object. * @throws PropelException */ public function getsfAssetFolder(PropelPDO $con = null) { if ($this->asfAssetFolder === null && $this->folder_id !== null) { $c = new Criteria(sfAssetFolderPeer::DATABASE_NAME); $c->add(sfAssetFolderPeer::ID, $this->folder_id); $this->asfAssetFolder = sfAssetFolderPeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->asfAssetFolder->addsfAssets($this); */ } return $this->asfAssetFolder; }