correctPath() публичный статический Метод

public static correctPath ( string $path ) : string
$path string
Результат string
Пример #1
0
 /**
  * @static
  * @param $path
  * @return bool
  */
 public static function pathExists($path, $type = null)
 {
     $path = Element\Service::correctPath($path);
     try {
         $object = new AbstractObject();
         if (\Pimcore\Tool::isValidPath($path)) {
             $object->getDao()->getByPath($path);
             return true;
         }
     } catch (\Exception $e) {
     }
     return false;
 }
Пример #2
0
 /**
  * @param string $path
  * @return self
  */
 public static function getByPath($path)
 {
     $path = Model\Element\Service::correctPath($path);
     try {
         $object = new self();
         if (Tool::isValidPath($path)) {
             $object->getResource()->getByPath($path);
             return self::getById($object->getId());
         }
     } catch (\Exception $e) {
         \Logger::warning($e->getMessage());
     }
     return null;
 }
Пример #3
0
 /**
  * Static helper to get an asset by the passed path (returned is not the concrete asset like Asset\Folder!)
  *
  * @param string $path
  * @return Asset
  */
 public static function getByPath($path)
 {
     $path = Element\Service::correctPath($path);
     try {
         $asset = new Asset();
         if (Tool::isValidPath($path)) {
             $asset->getDao()->getByPath($path);
             return self::getById($asset->getId());
         }
     } catch (\Exception $e) {
         \Logger::warning($e->getMessage());
     }
     return null;
 }
Пример #4
0
 /**
  * Static helper to get a Document by it's path, only type Document is returned, not Document\Page, ... (see getConcreteByPath() )
  *
  * @param string $path
  * @return Document
  */
 public static function getByPath($path)
 {
     $path = Element\Service::correctPath($path);
     try {
         $document = new Document();
         // validate path
         if (Tool::isValidPath($path)) {
             $document->getResource()->getByPath($path);
         }
         return self::getById($document->getId());
     } catch (\Exception $e) {
         \Logger::debug($e->getMessage());
     }
     return null;
 }
Пример #5
0
 /**
  * @static
  * @param $path
  * @return bool
  */
 public static function pathExists($path, $type = null)
 {
     $path = Element\Service::correctPath($path);
     try {
         $document = new Document();
         // validate path
         if (\Pimcore\Tool::isValidPath($path)) {
             $document->getResource()->getByPath($path);
             return true;
         }
     } catch (\Exception $e) {
     }
     return false;
 }