當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::getInstance方法代碼示例

本文整理匯總了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();
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:10,代碼來源:Version20160114142234.php

示例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();
 }
開發者ID:haou1945,項目名稱:ec-cube,代碼行數:38,代碼來源:Version20150716110252.php

示例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;
 }
開發者ID:shhirose,項目名稱:ec-cube,代碼行數:25,代碼來源:FormEventSubscriber.php

示例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();
     }
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:12,代碼來源:Version20160216215635.php

示例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);
     }
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:13,代碼來源:Version20160908161616.php

示例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();
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:14,代碼來源:Version20160823172700.php

示例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;
 }
開發者ID:EC-CUBE,項目名稱:category-content-plugin,代碼行數:19,代碼來源:Version20150706204400.php

示例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();
 }
開發者ID:haou1945,項目名稱:ec-cube,代碼行數:52,代碼來源:Version20151116142354.php

示例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));
     }
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:19,代碼來源:Version20160413151321.php

示例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);
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:41,代碼來源:Version20161108095350.php

示例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;
 }
開發者ID:cohki,項目名稱:ec-cube,代碼行數:24,代碼來源:FormEventSubscriber.php

示例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);
        }
開發者ID:haou1945,項目名稱:ec-cube,代碼行數:31,代碼來源:index_dev.php

示例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);
     }
 }
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:7,代碼來源:log.php

示例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;
 }
開發者ID:haou1945,項目名稱:ec-cube,代碼行數:17,代碼來源:EccubeTestCase.php

示例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;
}
開發者ID:ec-cube,項目名稱:ec-cube,代碼行數:14,代碼來源:eccube_install.php


注:本文中的Eccube\Application::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。