/** * Down method * * @param Schema $schema */ public function down(Schema $schema) { if (Version::isSupportGetInstanceFunction()) { $app = Application::getInstance(); $meta = $this->getMetadata($app['orm.em']); $tool = new SchemaTool($app['orm.em']); $schemaFromMetadata = $tool->getSchemaFromMetadata($meta); // テーブル削除 foreach ($schemaFromMetadata->getTables() as $table) { if ($schema->hasTable($table->getName())) { $schema->dropTable($table->getName()); } } // シーケンス削除 foreach ($schemaFromMetadata->getSequences() as $sequence) { if ($schema->hasSequence($sequence->getName())) { $schema->dropSequence($sequence->getName()); } } } else { if ($schema->hasTable(self::MAKER)) { $schema->dropTable(self::MAKER); } if ($schema->hasTable(self::PRODUCTMAKER)) { $schema->dropTable(self::PRODUCTMAKER); } } if ($this->connection->getDatabasePlatform()->getName() == 'postgresql') { foreach ($this->sequence as $sequence) { if ($schema->hasSequence($sequence)) { $schema->dropSequence($sequence); } } } }
/** * Create product form to submit. * * @return array */ protected function createFormData() { /** * @var Generator $faker */ $faker = $this->getFaker(); $form = array('class' => array('product_type' => 1, 'price01' => $faker->randomNumber(5), 'price02' => $faker->randomNumber(5), 'stock' => $faker->randomNumber(3), 'stock_unlimited' => 0, 'code' => $faker->word, 'sale_limit' => null, 'delivery_date' => ''), 'name' => $faker->word, 'product_image' => null, 'description_detail' => $faker->text, 'description_list' => $faker->paragraph, 'Category' => null, 'Tag' => 1, 'search_word' => $faker->word, 'free_area' => $faker->text, 'Status' => 1, 'note' => $faker->text, 'tags' => null, 'images' => null, 'add_images' => null, 'delete_images' => null, '_token' => 'dummy'); if (Version::isSupport('3.0.9', '==')) { unset($form['Tag']); $form['tag'] = $faker->word; } return $form; }
<?php /* * This file is part of the Maker plugin * * Copyright (C) 2016 LOCKON CO.,LTD. All Rights Reserved. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use Plugin\Maker\Util\Version; if (Version::isSupportLogFunction()) { return; } if (function_exists('log_emergency') === false) { /** * Log emergency. * Urgent alert. System is unusable. * * @param string $message * @param array $context */ function log_emergency($message, array $context = array()) { if (isset($GLOBALS['eccube_logger'])) { $GLOBALS['eccube_logger']->emergency($message, $context); } } } if (function_exists('log_alert') === false) { /**
/** * v3.0.9以降のフックポイントに対応しているのか. * * @return bool */ private function supportNewHookPoint() { return Version::isSupport(); }