示例#1
0
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <*****@*****.**>
 * @copyright 2007-2015 PrestaShop SA
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 */
use PrestaShop\PrestaShop\Adapter\ServiceLocator;
use PrestaShop\PrestaShop\Core\ContainerBuilder;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Filesystem\Filesystem;
$container_builder = new ContainerBuilder();
$container = $container_builder->build();
ServiceLocator::setServiceContainerInstance($container);
if (!file_exists(_PS_CACHE_DIR_)) {
    @mkdir(_PS_CACHE_DIR_);
    $warmer = new CacheWarmerAggregate([new PrestaShopBundle\Cache\LocalizationWarmer(_PS_VERSION_, 'en')]);
    $warmer->warmUp(_PS_CACHE_DIR_);
}
$configDirectory = __DIR__ . '/../app/config';
$phpParametersFilepath = $configDirectory . '/parameters.php';
$yamlParametersFilepath = $configDirectory . '/parameters.yml';
$filesystem = new Filesystem();
$exportPhpConfigFile = function ($config, $destination) use($filesystem) {
    return $filesystem->dumpFile($destination, '<?php return ' . var_export($config, true) . ';' . "\n");
};
// Bootstrap an application with parameters.yml, which has been installed before PHP parameters file support
示例#2
0
 public function setup()
 {
     $containerBuilder = new ContainerBuilder();
     $this->container = $containerBuilder->build();
     $this->entityManager = $this->container->make('\\PrestaShop\\PrestaShop\\Core\\Foundation\\Database\\EntityManager');
 }