Beispiel #1
0
    /**
     * Creates a mapping array for each shopware model.
     * The array key is the table name and the array item contains the model name and the namespace of the model.
     * @return array
     */
    private function getTableMapping()
    {
        $driver = $this->getDatabaseDriver();
        $allMetaData = $this->em->getMetadataFactory()->getAllMetadata();
        $tableMapping = array();
        /**@var $metaData \Doctrine\ORM\Mapping\ClassMetadata*/
        foreach ($allMetaData as $metaData) {
            $arrayKey = $driver->getClassNameForTable($metaData->getTableName());
            $tableMapping[$arrayKey] = array(
                'namespace' => $metaData->namespace,
                'name' => str_replace($metaData->namespace . '\\', '', $metaData->name)
            );
        }

        return $tableMapping;
    }