@@ -365,8 +365,8 @@ |
||
| 365 | 365 | * @throws PropelException Any exceptions caught during processing will be |
| 366 | 366 | * rethrown wrapped into a PropelException. |
| 367 | 367 | */ |
| 368 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
| 369 | - { |
|
| 368 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
| 369 | + { |
|
| 370 | 370 | if (null === $con) { |
| 371 | 371 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 372 | 372 | } |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | * first dimension keys are the type constants |
| 103 | 103 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
| 104 | 104 | */ |
| 105 | - protected static $fieldNames = array ( |
|
| 106 | - self::TYPE_PHPNAME => array('Id', 'Name', 'Datecreate', 'Desc', ), |
|
| 107 | - self::TYPE_CAMELNAME => array('id', 'name', 'datecreate', 'desc', ), |
|
| 108 | - self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID, SelfpriceTableMap::COL_NAME, SelfpriceTableMap::COL_DATECREATE, SelfpriceTableMap::COL_DESC, ), |
|
| 109 | - self::TYPE_FIELDNAME => array('id', 'name', 'datecreate', 'desc', ), |
|
| 110 | - self::TYPE_NUM => array(0, 1, 2, 3, ) |
|
| 105 | + protected static $fieldNames = array( |
|
| 106 | + self::TYPE_PHPNAME => array('Id', 'Name', 'Datecreate', 'Desc',), |
|
| 107 | + self::TYPE_CAMELNAME => array('id', 'name', 'datecreate', 'desc',), |
|
| 108 | + self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID, SelfpriceTableMap::COL_NAME, SelfpriceTableMap::COL_DATECREATE, SelfpriceTableMap::COL_DESC,), |
|
| 109 | + self::TYPE_FIELDNAME => array('id', 'name', 'datecreate', 'desc',), |
|
| 110 | + self::TYPE_NUM => array(0, 1, 2, 3,) |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | * first dimension keys are the type constants |
| 117 | 117 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
| 118 | 118 | */ |
| 119 | - protected static $fieldKeys = array ( |
|
| 120 | - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Datecreate' => 2, 'Desc' => 3, ), |
|
| 121 | - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3, ), |
|
| 122 | - self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID => 0, SelfpriceTableMap::COL_NAME => 1, SelfpriceTableMap::COL_DATECREATE => 2, SelfpriceTableMap::COL_DESC => 3, ), |
|
| 123 | - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3, ), |
|
| 124 | - self::TYPE_NUM => array(0, 1, 2, 3, ) |
|
| 119 | + protected static $fieldKeys = array( |
|
| 120 | + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Datecreate' => 2, 'Desc' => 3,), |
|
| 121 | + self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3,), |
|
| 122 | + self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID => 0, SelfpriceTableMap::COL_NAME => 1, SelfpriceTableMap::COL_DATECREATE => 2, SelfpriceTableMap::COL_DESC => 3,), |
|
| 123 | + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3,), |
|
| 124 | + self::TYPE_NUM => array(0, 1, 2, 3,) |
|
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | $criteria = $criteria->buildCriteria(); // build Criteria from Selfprice object |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ($criteria->containsKey(SelfpriceTableMap::COL_ID) && $criteria->keyContainsValue(SelfpriceTableMap::COL_ID) ) { |
|
| 407 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.SelfpriceTableMap::COL_ID.')'); |
|
| 406 | + if ($criteria->containsKey(SelfpriceTableMap::COL_ID) && $criteria->keyContainsValue(SelfpriceTableMap::COL_ID)) { |
|
| 407 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . SelfpriceTableMap::COL_ID . ')'); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | // use transaction because $criteria could contain info |
| 415 | 415 | // for more than one table (I guess, conceivably) |
| 416 | - return $con->transaction(function () use ($con, $query) { |
|
| 416 | + return $con->transaction(function() use ($con, $query) { |
|
| 417 | 417 | return $query->doInsert($con); |
| 418 | 418 | }); |
| 419 | 419 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function getUpSQL() |
| 39 | 39 | { |
| 40 | 40 | return array ( |
| 41 | - 'default' => ' |
|
| 41 | + 'default' => ' |
|
| 42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
| 44 | 44 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function getDownSQL() |
| 69 | 69 | { |
| 70 | 70 | return array ( |
| 71 | - 'default' => ' |
|
| 71 | + 'default' => ' |
|
| 72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
| 74 | 74 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getUpSQL() |
| 39 | 39 | { |
| 40 | - return array ( |
|
| 40 | + return array( |
|
| 41 | 41 | 'default' => ' |
| 42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getDownSQL() |
| 69 | 69 | { |
| 70 | - return array ( |
|
| 70 | + return array( |
|
| 71 | 71 | 'default' => ' |
| 72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function getUpSQL() |
| 39 | 39 | { |
| 40 | 40 | return array ( |
| 41 | - 'default' => ' |
|
| 41 | + 'default' => ' |
|
| 42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
| 44 | 44 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function getDownSQL() |
| 69 | 69 | { |
| 70 | 70 | return array ( |
| 71 | - 'default' => ' |
|
| 71 | + 'default' => ' |
|
| 72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
| 74 | 74 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getUpSQL() |
| 39 | 39 | { |
| 40 | - return array ( |
|
| 40 | + return array( |
|
| 41 | 41 | 'default' => ' |
| 42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getDownSQL() |
| 69 | 69 | { |
| 70 | - return array ( |
|
| 70 | + return array( |
|
| 71 | 71 | 'default' => ' |
| 72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
| 73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | class ServiceProvider extends AbstractServiceProvider |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - protected $provides = [ |
|
| 15 | + protected $provides = [ |
|
| 16 | 16 | |
| 17 | - ]; |
|
| 17 | + ]; |
|
| 18 | 18 | |
| 19 | - public function register() |
|
| 20 | - { |
|
| 19 | + public function register() |
|
| 20 | + { |
|
| 21 | 21 | |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -4,10 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Symfony\Component\Console\Application as CoreApp; |
| 6 | 6 | use Symfony\Component\Console\Input\InputInterface; |
| 7 | -use Symfony\Component\Console\Output\OutputInterface; |
|
| 8 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 9 | -use Symfony\Component\Console\Input\InputOption; |
|
| 10 | -use Symfony\Component\Finder\Finder; |
|
| 11 | 7 | |
| 12 | 8 | class Application extends CoreApp |
| 13 | 9 | { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // exit('f'); |
| 29 | 29 | // } |
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Gets the default commands that should always be available. |
| 33 | 33 | * |
| 34 | 34 | * @return array An array of default Command instances |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $defaultCommands[] = new \Symfony\Component\Console\Command\HelpCommand(); |
| 43 | 43 | |
| 44 | - $defaultCommands[] = new \Frameworkless\Console\Commands\TestCommand(); |
|
| 44 | + $defaultCommands[] = new \Frameworkless\Console\Commands\TestCommand(); |
|
| 45 | 45 | |
| 46 | 46 | return $defaultCommands; |
| 47 | 47 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | |
| 67 | - function __o(){ |
|
| 67 | + function __o(){ |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | |
| 67 | - function __o(){ |
|
| 67 | + function __o() { |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -10,26 +10,26 @@ |
||
| 10 | 10 | class User implements \Frameworkless\SeedInterface |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * |
|
| 15 | - * @param type $id |
|
| 16 | - * @return type |
|
| 17 | - */ |
|
| 18 | - static public function build($id = 1) |
|
| 19 | - { |
|
| 20 | - $generator = \Faker\Factory::create(); |
|
| 21 | - $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
| 22 | - $populator->addEntity(\Core\Models\User\User::class, $id); |
|
| 23 | - return $populator->execute(); |
|
| 24 | - } |
|
| 13 | + /** |
|
| 14 | + * |
|
| 15 | + * @param type $id |
|
| 16 | + * @return type |
|
| 17 | + */ |
|
| 18 | + static public function build($id = 1) |
|
| 19 | + { |
|
| 20 | + $generator = \Faker\Factory::create(); |
|
| 21 | + $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
| 22 | + $populator->addEntity(\Core\Models\User\User::class, $id); |
|
| 23 | + return $populator->execute(); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * |
|
| 28 | - * @return type |
|
| 29 | - */ |
|
| 30 | - public static function reset() |
|
| 31 | - { |
|
| 32 | - return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
| 33 | - } |
|
| 26 | + /** |
|
| 27 | + * |
|
| 28 | + * @return type |
|
| 29 | + */ |
|
| 30 | + public static function reset() |
|
| 31 | + { |
|
| 32 | + return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
@@ -18,39 +18,39 @@ |
||
| 18 | 18 | class SeedCommand extends Command |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - protected function configure() |
|
| 22 | - { |
|
| 23 | - $this->setName('seed:build') |
|
| 24 | - ->setDescription('Create seeds data') |
|
| 25 | - ->setDefinition( |
|
| 26 | - new InputDefinition(array( |
|
| 27 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
| 28 | - new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
| 29 | - )) |
|
| 30 | - ); |
|
| 31 | - $this->setName('seed:reset') |
|
| 32 | - ->setDescription('Reset seeds data') |
|
| 33 | - ->setDefinition( |
|
| 34 | - new InputDefinition(array( |
|
| 35 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
| 36 | - )) |
|
| 37 | - ); |
|
| 38 | - } |
|
| 21 | + protected function configure() |
|
| 22 | + { |
|
| 23 | + $this->setName('seed:build') |
|
| 24 | + ->setDescription('Create seeds data') |
|
| 25 | + ->setDefinition( |
|
| 26 | + new InputDefinition(array( |
|
| 27 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
| 28 | + new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
| 29 | + )) |
|
| 30 | + ); |
|
| 31 | + $this->setName('seed:reset') |
|
| 32 | + ->setDescription('Reset seeds data') |
|
| 33 | + ->setDefinition( |
|
| 34 | + new InputDefinition(array( |
|
| 35 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
| 36 | + )) |
|
| 37 | + ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 41 | - { |
|
| 40 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 41 | + { |
|
| 42 | 42 | |
| 43 | - if (!$class = $input->getOption('class')) { |
|
| 44 | - $output->writeln("Model not set"); |
|
| 45 | - return; |
|
| 46 | - } |
|
| 43 | + if (!$class = $input->getOption('class')) { |
|
| 44 | + $output->writeln("Model not set"); |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - if ($input->getArgument('command') == "seed:reset" && $class::reset()) { |
|
| 49 | - $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
| 50 | - } else { |
|
| 51 | - $number = $input->getOption('amount'); |
|
| 52 | - $class::build($number > 1 ? $number : 1); |
|
| 53 | - $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
| 54 | - } |
|
| 55 | - } |
|
| 48 | + if ($input->getArgument('command') == "seed:reset" && $class::reset()) { |
|
| 49 | + $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
| 50 | + } else { |
|
| 51 | + $number = $input->getOption('amount'); |
|
| 52 | + $class::build($number > 1 ? $number : 1); |
|
| 53 | + $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -21,23 +21,23 @@ |
||
| 21 | 21 | |
| 22 | 22 | protected function execute(InputInterface $input, OutputInterface $output) |
| 23 | 23 | { |
| 24 | - $finder = \Symfony\Component\Finder\Finder::create(); |
|
| 24 | + $finder = \Symfony\Component\Finder\Finder::create(); |
|
| 25 | 25 | |
| 26 | - $root_path = __DIR__ . "../../../.."; |
|
| 26 | + $root_path = __DIR__ . "../../../.."; |
|
| 27 | 27 | |
| 28 | - $iterator = $finder |
|
| 29 | - ->files() |
|
| 30 | - ->in($root_path . "/vendor/*/*/db"); |
|
| 28 | + $iterator = $finder |
|
| 29 | + ->files() |
|
| 30 | + ->in($root_path . "/vendor/*/*/db"); |
|
| 31 | 31 | |
| 32 | - foreach ($iterator as $file) { |
|
| 32 | + foreach ($iterator as $file) { |
|
| 33 | 33 | |
| 34 | - if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) { |
|
| 35 | - $output->writeln( sprintf("error copy migration %s...", $file->getRelativePathname()) ); |
|
| 36 | - } |
|
| 37 | - else{ |
|
| 38 | - $output->writeln( sprintf("copy migration %s", $file->getRelativePathname()) ); |
|
| 39 | - } |
|
| 40 | - } |
|
| 34 | + if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) { |
|
| 35 | + $output->writeln( sprintf("error copy migration %s...", $file->getRelativePathname()) ); |
|
| 36 | + } |
|
| 37 | + else{ |
|
| 38 | + $output->writeln( sprintf("copy migration %s", $file->getRelativePathname()) ); |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | $output->writeln("completed!"); |
| 43 | 43 | } |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | foreach ($iterator as $file) { |
| 33 | 33 | |
| 34 | 34 | if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) { |
| 35 | - $output->writeln( sprintf("error copy migration %s...", $file->getRelativePathname()) ); |
|
| 35 | + $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
|
| 36 | 36 | } |
| 37 | - else{ |
|
| 38 | - $output->writeln( sprintf("copy migration %s", $file->getRelativePathname()) ); |
|
| 37 | + else { |
|
| 38 | + $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) { |
| 35 | 35 | $output->writeln( sprintf("error copy migration %s...", $file->getRelativePathname()) ); |
| 36 | - } |
|
| 37 | - else{ |
|
| 36 | + } else{ |
|
| 38 | 37 | $output->writeln( sprintf("copy migration %s", $file->getRelativePathname()) ); |
| 39 | 38 | } |
| 40 | 39 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | interface SeedInterface |
| 11 | 11 | { |
| 12 | - static public function build($id = 1); |
|
| 12 | + static public function build($id = 1); |
|
| 13 | 13 | |
| 14 | - static public function reset(); |
|
| 14 | + static public function reset(); |
|
| 15 | 15 | } |