本文整理汇总了PHP中Eccube\Application::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getInstance方法的具体用法?PHP Application::getInstance怎么用?PHP Application::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eccube\Application
的用法示例。
在下文中一共展示了Application::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: down
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$app = \Eccube\Application::getInstance();
$em = $app['orm.em'];
$this->delete_dtb_csv($em);
$em->flush();
}
示例2: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
if (!$schema->hasTable(self::NAME)) {
return true;
}
$app = \Eccube\Application::getInstance();
$em = $app["orm.em"];
$CsvType = new CsvType();
$CsvType->setId(1);
$CsvType->setName('商品CSV');
$CsvType->setRank(3);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(2);
$CsvType->setName('会員CSV');
$CsvType->setRank(4);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(3);
$CsvType->setName('受注CSV');
$CsvType->setRank(1);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(4);
$CsvType->setName('配送CSV');
$CsvType->setRank(2);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(5);
$CsvType->setName('カテゴリCSV');
$CsvType->setRank(5);
$em->persist($CsvType);
$em->flush();
}
示例3: getEvents
public static function getEvents()
{
$events = array();
// YamlでParseしてがんばる
$basePath = __DIR__ . '/../../../app/Plugin';
$finder = Finder::create()->in($basePath)->directories()->depth(0);
$app = \Eccube\Application::getInstance();
foreach ($finder as $dir) {
$code = $dir->getBaseName();
$path = $dir->getRealPath();
try {
$app['eccube.service.plugin']->checkPluginArchiveContent($path);
} catch (\Eccube\Exception\PluginException $e) {
$app['monolog']->warning("skip {$code} form events loading. config.yml not foud or invalid.", array('path' => $path, 'original-message' => $e->getMessage()));
continue;
}
$config = $app['eccube.service.plugin']->readYml($path . '/config.yml');
if (isset($config['form'])) {
foreach ($config['form'] as $event => $class) {
$events[$event][] = '\\Plugin\\' . $config['code'] . '\\' . $class;
}
}
}
return $events;
}
示例4: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$app = \Eccube\Application::getInstance();
$PageLayout = $app['eccube.repository.page_layout']->findOneBy(array('url' => 'forgot_reset', 'name' => 'パスワード変更((完了ページ)'));
if ($PageLayout) {
$PageLayout->setName('パスワード変更(完了ページ)');
$app['orm.em']->flush();
}
}
示例5: down
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$app = \Eccube\Application::getInstance();
$em = $app["orm.em"];
$DeliveryDate = $app['eccube.repository.delivery_date']->find(9);
if ($DeliveryDate->getValue() === -1) {
$DeliveryDate->setValue(0);
$em->flush($DeliveryDate);
}
}
示例6: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$app = \Eccube\Application::getInstance();
/** @var EntityManager $em */
$em = $app["orm.em"];
$DeviceType = $app['eccube.repository.master.device_type']->find(10);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType)->setName('MYページ/お届け先編集')->setUrl('mypage_delivery_edit')->setFileName('Mypage/delivery_edit')->setEditFlg(2)->setMetaRobots('noindex');
$em->persist($PageLayout);
$em->flush();
}
示例7: createCategoryContent
/**
* Create recommend table.
*
* @param Schema $schema
*
* @return bool
*/
protected function createCategoryContent(Schema $schema)
{
if ($schema->hasTable(self::NAME)) {
return true;
}
$app = Application::getInstance();
$em = $app['orm.em'];
$classes = array($em->getClassMetadata('Plugin\\CategoryContent\\Entity\\CategoryContent'));
$tool = new SchemaTool($em);
$tool->createSchema($classes);
return true;
}
示例8: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
// pageを追加
$app = \Eccube\Application::getInstance();
$em = $app["orm.em"];
$DeviceType = $app['eccube.repository.master.device_type']->find(10);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType);
$PageLayout->setName('商品購入/配送方法選択');
$PageLayout->setUrl('shopping_delivery');
$PageLayout->setFileName('Shopping/index');
$PageLayout->setEditFlg(2);
$PageLayout->setMetaRobots('noindex');
$em->persist($PageLayout);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType);
$PageLayout->setName('商品購入/支払方法選択');
$PageLayout->setUrl('shopping_payment');
$PageLayout->setFileName('Shopping/index');
$PageLayout->setEditFlg(2);
$PageLayout->setMetaRobots('noindex');
$em->persist($PageLayout);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType);
$PageLayout->setName('商品購入/お届け先変更');
$PageLayout->setUrl('shopping_shipping_change');
$PageLayout->setFileName('Shopping/index');
$PageLayout->setEditFlg(2);
$PageLayout->setMetaRobots('noindex');
$em->persist($PageLayout);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType);
$PageLayout->setName('商品購入/お届け先変更');
$PageLayout->setUrl('shopping_shipping_edit_change');
$PageLayout->setFileName('Shopping/index');
$PageLayout->setEditFlg(2);
$PageLayout->setMetaRobots('noindex');
$em->persist($PageLayout);
$PageLayout = new PageLayout();
$PageLayout->setDeviceType($DeviceType);
$PageLayout->setName('商品購入/お届け先の複数指定');
$PageLayout->setUrl('shopping_shipping_multiple_change');
$PageLayout->setFileName('Shopping/index');
$PageLayout->setEditFlg(2);
$PageLayout->setMetaRobots('noindex');
$em->persist($PageLayout);
$em->flush();
}
示例9: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
// path.ymlの更新
$app = Application::getInstance();
$file = $app['config']['root_dir'] . '/app/config/eccube/path.yml';
$config = Yaml::parse(file_get_contents($file));
if (!array_key_exists('public_path', $config)) {
// public_pathが未定義なら作成
$config['public_path'] = '/html';
$config['public_path_realdir'] = $config['root_dir'] . $config['public_path'];
$config['plugin_html_realdir'] = $config['root_dir'] . $config['public_path'] . '/plugin';
$config['plugin_urlpath'] = $config['root_urlpath'] . '/plugin';
file_put_contents($file, Yaml::dump($config));
}
}
示例10: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$app = Application::getInstance();
$repository = $app['orm.em']->getRepository('Eccube\\Entity\\Master\\ProductListOrderBy');
// mtb_product_list_orderbyが初期状態から変更がある場合は、マイグレーションを適用しない
$default = array(array('id' => 1, 'name' => '価格順', 'rank' => 0), array('id' => 2, 'name' => '新着順', 'rank' => 1));
$entities = $repository->createQueryBuilder('pl')->orderBy('pl.id', 'ASC')->getQuery()->getArrayResult();
if ($entities !== $default) {
return;
}
// 価格が高い順を追加
$ProductListOrderBy = new ProductListOrderBy();
$ProductListOrderBy->setId(3);
$ProductListOrderBy->setName('価格が高い順');
$ProductListOrderBy->setRank(2);
$app['orm.em']->persist($ProductListOrderBy);
$app['orm.em']->flush($ProductListOrderBy);
// "価格順"の名称を"価格が低い順"へ変更
$ProductListOrderBy = $repository->find(1);
if (!is_null($ProductListOrderBy) && $ProductListOrderBy->getName() === '価格順') {
$ProductListOrderBy->setName('価格が低い順');
$app['orm.em']->persist($ProductListOrderBy);
$app['orm.em']->flush($ProductListOrderBy);
}
// 価格が低い順->価格が高い順->新着順の順にrankを振り直す
// 価格が低い順
$entity = $repository->find(1);
$entity->setRank(0);
$app['orm.em']->flush($entity);
// 価格が高い順
$entity = $repository->find(3);
$entity->setRank(1);
$app['orm.em']->flush($entity);
// 新着順
$entity = $repository->find(2);
$entity->setRank(2);
$app['orm.em']->flush($entity);
}
示例11: getEvents
public static function getEvents()
{
$events = array();
// YamlでParseしてがんばる
$basePath = __DIR__ . '/../../../app/Plugin';
$finder = Finder::create()->in($basePath)->directories()->depth(0);
$app = \Eccube\Application::getInstance();
foreach ($finder as $dir) {
$config = Yaml::parse(file_get_contents($dir->getRealPath() . '/config.yml'));
try {
$app['eccube.service.plugin']->checkPluginArchiveContent($dir->getRealPath());
} catch (\Eccube\Exception\PluginException $e) {
$app['monolog']->warning($e->getMessage());
continue;
}
$config = $app['eccube.service.plugin']->readYml($dir->getRealPath() . '/config.yml');
if (isset($config['form'])) {
foreach ($config['form'] as $event => $class) {
$events[$event][] = '\\Plugin\\' . $config['code'] . '\\' . $class;
}
}
}
return $events;
}
示例12: array
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
use Symfony\Component\Debug\Debug;
use Symfony\Component\Yaml\Yaml;
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
$allow = array('127.0.0.1', 'fe80::1', '::1');
if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], $allow)) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}
require_once __DIR__ . '/../autoload.php';
Debug::enable();
// load configs.
$app = \Eccube\Application::getInstance();
// debug enable.
$app['debug'] = true;
// initialize servicies.
$app->initialize();
$app->initializePlugin();
// load config dev
$conf = $app['config'];
$app['config'] = $app->share(function () use($conf) {
$confarray = array();
$config_dev_file = __DIR__ . '/../app/config/eccube/config_dev.yml';
if (file_exists($config_dev_file)) {
$config_dev = Yaml::parse(file_get_contents($config_dev_file));
if (isset($config_dev)) {
$confarray = array_replace_recursive($confarray, $config_dev);
}
示例13: log_debug
function log_debug($message, array $context = array())
{
$app = \Eccube\Application::getInstance();
if (isset($app['eccube.logger'])) {
$app['eccube.logger']->debug($message, $context);
}
}
示例14: createApplication
/**
* {@inheritdoc}
*/
public function createApplication()
{
$app = Application::getInstance();
$app['debug'] = true;
$app->initialize();
$app->initPluginEventDispatcher();
$app['session.test'] = true;
$app['exception_handler']->disable();
$app['form.csrf_provider'] = $app->share(function () {
return new CsrfTokenMock();
});
$app->boot();
return $app;
}
示例15: createApplication
/**
* @return \Eccube\Application
*/
function createApplication()
{
$app = \Eccube\Application::getInstance();
$app['debug'] = true;
$app->initDoctrine();
$app->initSecurity();
$app->register(new \Silex\Provider\FormServiceProvider());
$app->register(new \Eccube\ServiceProvider\EccubeServiceProvider());
$app->boot();
return $app;
}