Return the structure for the given StructureBehavior implementing document.

@param StructureBehavior $document

@return StructureMetadata
512457
public function getStructureMetadata(StructureBehavior $document)
    {
        try {
            return $this->structureFactory->getStructureMetadata(
                $this->getMetadata($document)->getAlias(),
                $document->getStructureType()
            );
        } catch (StructureTypeNotFoundException $exception) {
            return;
        }
    }
774490
public function decode(Document $document)
    {
        $suites = [];

        foreach ($document->query('//suite') as $suiteEl) {
            $suites[] = $this->processSuite($suiteEl);
        }

        return new SuiteCollection($suites);
    }
1343399
private function invalidateDocumentExcerpt(ExtensionBehavior $document)
    {
        if (!$this->cacheManager) {
            return;
        }

        $extensionData = $document->getExtensionsData();
        if (!isset($extensionData['excerpt'])) {
            return;
        }

        $excerpt = $extensionData['excerpt'];

        if (isset($excerpt['tags'])) {
            foreach ($this->tagManager->resolveTagNames($excerpt['tags']) as $tag) {
                $this->cacheManager->invalidateReference('tag', $tag);
            }
        }

        if (isset($excerpt['categories'])) {
            foreach ($excerpt['categories'] as $category) {
                $this->cacheManager->invalidateReference('category', $category);
            }
        }
    }
1198171
protected function getStateFormatted(Document $document) 
	{
		switch($document->getState()) {
			case Document::DOCUMENT_STATE_ACTIVE:
				$this->stateClass = 'success';
				return 'Attivo';
				break;
			case Document::DOCUMENT_STATE_DEACTIVE:
				$this->stateClass = 'warning';
				return 'Disattivo';
				break;
			case Document::DOCUMENT_STATE_DELETED:
				$this->stateClass = 'danger';
				return 'Eliminato';
				break;
		}

		$this->stateClass = 'danger';
		return 'Error with document state';
	}
760458
public function getDocumentActualData($document)
    {
        $class      = $this->dm->getClassMetadata(get_class($document));
        $actualData = [];

        foreach ($class->propertyMetadata as $name => $mapping) {
            // skip not saved attributes
            if ($mapping->notSaved) {
                continue;
            }

            $value = $mapping->getValue($document);

            if ($mapping->isMany() && $value !== null && !($value instanceof PersistentCollectionInterface)) {
                // If $actualData[$name] is not a Collection then use an ArrayCollection.
                if (!$value instanceof Collection) {
                    $value = new ArrayCollection($value);
                }

                // Inject PersistentCollection
                $coll = $this->dm->getConfiguration()->getPersistentCollectionFactory()->create($this->dm, $mapping, $value);
                $coll->setOwner($document, $mapping);
                $coll->setDirty(!$value->isEmpty());
                $mapping->setValue($document, $coll);
                $actualData[$name] = $coll;
            } else {
                $actualData[$name] = $value;
            }
        }

        return $actualData;
    }
364394
public function updateDocument(\Document $document)
  {
    $arrSet = $this->buildDocumentDataArray($document, false);
    
    $this->Database->prepare("UPDATE tl_dms_documents %s WHERE id=?")->set($arrSet)->execute($document->id);
    
    return $document;
  }
503730
public function storeDocument(\Document $document)
  {
    $arrSet = $this->buildDocumentDataArray($document, false);
    
    $objDocument = $this->Database->prepare("INSERT INTO tl_dms_documents %s")->set($arrSet)->execute();
    
    $document->id = $objDocument->insertId;
    return $document;
  }
1306778
protected function getDate(Document $document) 
	{
		if(null === $document->getDateEdit()) {
			return $document->getDateInsert()->format('Y-m-d H:i:s');
		}
		
		return $document->getDateEdit()->format('Y-m-d H:i:s');
	}
564807
public function getDocumentId($document, $throw = true)
    {
        $oid = is_object($document) ? spl_object_hash($document) : $document;
        if (empty($this->documentIds[$oid])) {
            if (!$throw) {
                return;
            }
            $msg = 'Document is not managed and has no id';
            if (is_object($document)) {
                $msg .= ': '.self::objToStr($document);
            }

            throw new PHPCRException($msg);
        }

        return $this->documentIds[$oid];
    }
1177338
public function parseDocument(\DOMDocument $document)
    {
        foreach ($this->registry[DocumentExtension::class] as $extension) {
            $doc = $extension->parseDocument($this, $document);
            if ($doc) {
                return $doc;
            }
        }

        return null;
    }
697516
private function getDocumentActualData(ClassMetadata $class, $document)
    {
        $actualData = [];
        foreach ($class->reflFields as $fieldName => $reflProperty) {
            // do not set the version info fields if they have values, they are not to be managed by the user in write scenarios.
            if ($fieldName === $class->versionNameField
                || $fieldName === $class->versionCreatedField
            ) {
                continue;
            }
            $value = $reflProperty->getValue($document);
            $actualData[$fieldName] = $value;
        }

        return $actualData;
    }
1343593
private function addBreadcrumb(StructureBehavior $document, VisitorInterface $visitor)
    {
        $items = [];
        $parentDocument = $this->inspector->getParent($document);
        while ($parentDocument instanceof StructureBehavior) {
            $item = [];
            if ($parentDocument instanceof UuidBehavior) {
                $item['uuid'] = $parentDocument->getUuid();
            }

            $item['title'] = $parentDocument->getStructure()->getProperty('title')->getValue();

            $items[] = $item;

            $parentDocument = $this->inspector->getParent($parentDocument);
        }

        $items = array_reverse($items);

        array_walk(
            $items,
            function(&$item, $index) {
                $item['depth'] = $index;
            }
        );

        $visitor->addData('breadcrumb', $items);
    }
991076
public function getLocaleForDocument($document)
    {
        $oid = $this->getObjectIdentifier($document);
        $this->assertDocumentExists($document);

        return $this->documentLocaleMap[$oid];
    }
1001526
public function structureProto()
    {
        if ($this->structurePrototype === null) {
            $model = $this->createStructureModel();

            if ($model instanceof DescribableInterface) {
                $model->setMetadata($this->structureMetadata());
            }

            $this->structurePrototype = $model;
        }

        return $this->structurePrototype;
    }
443199
public function get($structure, $default = null)
    {
        if ($structure instanceof Structure) {
            return $structure->get($this->path, $default, $this->separator);
        }

        return StructureHelper::getByPath($structure, $this->path, $this->separator ?: '.');
    }
304991
private function getArticleType(ArticleDocument $articleDocument)
    {
        $structureMetadata = $this->structureMetadataFactory->getStructureMetadata(
            'article',
            $articleDocument->getStructureType()
        );

        return $this->getType($structureMetadata);
    }
563884
function getContainer(document) {
  var content = structuralFiles.getContainer(document);
  return replacements(document, replacements(document, content));
}