VersionPress\Database\DbSchemaInfo::getAllMnReferences PHP Method

getAllMnReferences() public method

public getAllMnReferences ( )
    public function getAllMnReferences()
    {
        $mnReferences = [];
        foreach ($this->getAllEntityNames() as $entityName) {
            $entityInfo = $this->getEntityInfo($entityName);
            if (!$entityInfo->mnReferences) {
                continue;
            }
            foreach ($entityInfo->mnReferences as $reference => $targetEntity) {
                if ($entityInfo->isVirtualReference($reference)) {
                    continue;
                }
                $mnReferences[] = ReferenceUtils::getMnReferenceDetails($this, $entityName, $reference);
            }
        }
        return $mnReferences;
    }

Usage Example

 /**
  * Saves all eligible entities into the file system storage (the 'db' folder)
  */
 private function saveDatabaseToStorages()
 {
     if (is_dir(VP_VPDB_DIR)) {
         FileSystem::remove(VP_VPDB_DIR);
     }
     FileSystem::mkdir(VP_VPDB_DIR);
     $entityNames = $this->synchronizerFactory->getSynchronizationSequence();
     foreach ($entityNames as $entityName) {
         $this->createVpidsForEntitiesOfType($entityName);
         $this->saveEntitiesOfTypeToStorage($entityName);
     }
     $mnReferenceDetails = $this->dbSchema->getAllMnReferences();
     foreach ($mnReferenceDetails as $referenceDetail) {
         $this->saveMnReferences($referenceDetail);
     }
 }
All Usage Examples Of VersionPress\Database\DbSchemaInfo::getAllMnReferences