getProxyFactory example

$plugin->setUpdated(new DateTime());
            $em->flush($plugin);
            $this->write();

            $em->flush();

            $this->Application()->Container()->get(DatabaseHandler::class)->loadToDatabase($bootstrap->Path() . 'Snippets/');
            $this->Application()->Container()->get(DatabaseHandler::class)->loadToDatabase($bootstrap->Path() . 'snippets/');
            $this->Application()->Container()->get(DatabaseHandler::class)->loadToDatabase($bootstrap->Path() . 'Resources/snippet/');

            // Clear proxy cache             $this->Application()->Hooks()->getProxyFactory()->clearCache();
        }

        $db = $this->Application()->Container()->get('db');

        $resourceId = $db->fetchOne(
            "SELECT id FROM s_core_acl_resources WHERE name = 'widgets'"
        );

        if (!$resourceId) {
            return $result;
        }

        

    public function regenerateAttributeProxies($tableNames = [])
    {
        $metaDataCache = $this->getConfiguration()->getMetadataCacheImpl();

        if ($metaDataCache !== null && method_exists($metaDataCache, 'deleteAll')) {
            $metaDataCache->deleteAll();
        }

        $allMetaData = $this->getMetadataFactory()->getAllMetadata();
        $proxyFactory = $this->getProxyFactory();

        $attributeMetaData = [];
        foreach ($allMetaData as $metaData) {
            if (!$metaData instanceof ClassMetadata) {
                continue;
            }

            $tableName = $metaData->getTableName();
            if (!str_contains($tableName, '_attributes')) {
                continue;
            }
            
 elseif (!is_writable($proxyCacheDir)) {
                throw new \RuntimeException(sprintf('The Doctrine Proxy directory "%s" is not writeable for the current system user.', $proxyCacheDir));
            }

            // if proxies are autogenerated we don't need to generate them in the cache warmer             if ($em->getConfiguration()->getAutoGenerateProxyClasses()) {
                continue;
            }

            $classes = $em->getMetadataFactory()->getAllMetadata();

            $em->getProxyFactory()->generateProxyClasses($classes);

            foreach (scandir($proxyCacheDir) as $file) {
                if (!is_dir($file = $proxyCacheDir.'/'.$file)) {
                    $files[] = $file;
                }
            }
        }

        return $files;
    }
}

    }

    /** * Returns the proxy for the given class. If the Enlight_Hook_ProxyFactory hasn't * already instantiated it, the function instantiates it automatically. * * @param class-string $class */
    public function getProxy($class)
    {
        return $this->getProxyFactory()->getProxy($class);
    }

    /** * Checks if a proxy exists for the given class. * * @param class-string $class * * @return bool */
    public function hasProxy($class)
    {
        
Home | Imprint | This part of the site doesn't use cookies.