getDependedElement() public static method

public static getDependedElement ( array $config ) : AbstractObject | Document | Asset
$config array
return Pimcore\Model\Object\AbstractObject | Pimcore\Model\Document | Pimcore\Model\Asset
Esempio n. 1
0
 public function extractRelations($element, $apiElementKeys, $recursive, $includeRelations)
 {
     $foundRelations = array();
     if ($includeRelations) {
         $dependency = $element->getDependencies();
         if ($dependency) {
             foreach ($dependency->getRequires() as $r) {
                 if ($e = Element\Service::getDependedElement($r)) {
                     if ($element->getId() != $e->getId() and !in_array(Element\Service::getElementType($e) . "_" . $e->getId(), $apiElementKeys)) {
                         $foundRelations[Element\Service::getElementType($e) . "_" . $e->getId()] = array("elementType" => Element\Service::getType($e), "element" => $e->getId(), "recursive" => false);
                     }
                 }
             }
         }
     }
     $childs = $element->getChilds();
     if ($recursive and $childs) {
         foreach ($childs as $child) {
             if (!in_array(Element\Service::getType($child) . "_" . $child->getId(), $apiElementKeys)) {
                 $foundRelations[Element\Service::getType($child) . "_" . $child->getId()] = array("elementType" => Element\Service::getType($child), "element" => $child->getId(), "recursive" => $recursive);
             }
         }
     }
     return $foundRelations;
 }