Added to the basic app, fixed config, added to core commands. #1759

Merged
merged 3 commits into from Jan 3, 2014

Conversation

Projects
None yet
5 participants
@Ragazzo
Contributor

Ragazzo commented Jan 3, 2014

I added to the basic application console.php config to avoid unnecessary exception with fixtures path is not configured right and added db config (db is needed for apply/clear actions), i also added folder templates where by default will be hosted templates for yii2-faker, so user should not worry how to configure it and everything will be by default for him.
Added fixture to the core commands. Improved some messages and checks.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

also @qiangxue do we need to have some $this->confirm() for user when he trying to apply/clear actions of fixture controller? i think it would be another useful extra-check for user, and should be implemented. What do you think?

Contributor

Ragazzo commented Jan 3, 2014

also @qiangxue do we need to have some $this->confirm() for user when he trying to apply/clear actions of fixture controller? i think it would be another useful extra-check for user, and should be implemented. What do you think?

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

Related with #1756

Contributor

Ragazzo commented Jan 3, 2014

Related with #1756

@@ -19,6 +22,17 @@
],
],
],
+ 'db' => [
+ 'class' => 'yii\db\Connection',
+ 'dsn' => 'mysql:host=localhost;dbname=yii2basic',

This comment has been minimized.

@qiangxue

qiangxue Jan 3, 2014

Member

Please use yii2_basic to be consistent with DB setting in other places.

@qiangxue

qiangxue Jan 3, 2014

Member

Please use yii2_basic to be consistent with DB setting in other places.

This comment has been minimized.

This comment has been minimized.

@lucianobaraglia

lucianobaraglia Jan 3, 2014

Contributor

Just one comment...
Maybe it would be cleaner to separate db config in a separated file, just as $params.
That would help sharing (and versioning) the main config file wile each developer has it's own database configuration (ignored by CVS) without problem.

@lucianobaraglia

lucianobaraglia Jan 3, 2014

Contributor

Just one comment...
Maybe it would be cleaner to separate db config in a separated file, just as $params.
That would help sharing (and versioning) the main config file wile each developer has it's own database configuration (ignored by CVS) without problem.

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

@qiangxue should it be?

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

@qiangxue should it be?

This comment has been minimized.

@cebe

cebe Jan 3, 2014

Member

this is not part of this PR in general it is a good idea. Not sure if we should do it in basic app. Discussion should go in a separate issue.

@cebe

cebe Jan 3, 2014

Member

this is not part of this PR in general it is a good idea. Not sure if we should do it in basic app. Discussion should go in a separate issue.

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

yep, could you maybe create it?

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

yep, could you maybe create it?

@qiangxue

This comment has been minimized.

Show comment
Hide comment
@qiangxue

qiangxue Jan 3, 2014

Member

I think we need confirm() for any command that may cause change of the system.

Member

qiangxue commented Jan 3, 2014

I think we need confirm() for any command that may cause change of the system.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

I think we need confirm() for any command that may cause change of the system.

ok.

Contributor

Ragazzo commented Jan 3, 2014

I think we need confirm() for any command that may cause change of the system.

ok.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

Added confirmation. Ready for review. No sure if we for example need to add outputList method to basic console controller, anyway could be helpful, but ofcourse i am against any mess that is out of domain scope.

Contributor

Ragazzo commented Jan 3, 2014

Added confirmation. Ready for review. No sure if we for example need to add outputList method to basic console controller, anyway could be helpful, but ofcourse i am against any mess that is out of domain scope.

@creocoder

View changes

framework/yii/console/controllers/FixtureController.php
{
+ if ($this->getFixtureManager() == null) {

This comment has been minimized.

@creocoder

creocoder Jan 3, 2014

Contributor

== => ===

@creocoder

creocoder Jan 3, 2014

Contributor

== => ===

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

why?

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

why?

@creocoder

View changes

framework/yii/console/controllers/FixtureController.php
+ $this->stdout(realpath(Yii::getAlias($this->fixturePath)) . "\n\n", Console::FG_GREEN);
+
+ foreach($fixtures as $index => $fixture) {
+ $this->stdout($index +1 . ". " . $fixture . "\n", Console::FG_GREEN);

This comment has been minimized.

@creocoder

creocoder Jan 3, 2014

Contributor

$this->stdout($index + 1 . ". {$fixture}\n", Console::FG_GREEN);

@creocoder

creocoder Jan 3, 2014

Contributor

$this->stdout($index + 1 . ". {$fixture}\n", Console::FG_GREEN);

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

does not make sense.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

does not make sense.

@creocoder

View changes

apps/basic/config/console.php
@@ -1,4 +1,7 @@
<?php
+
+Yii::setAlias('tests', __DIR__ . '/../tests');

This comment has been minimized.

@creocoder

creocoder Jan 3, 2014

Contributor

Yii::setAlias('tests', realpath(__DIR__ . '/../tests'));

@creocoder

creocoder Jan 3, 2014

Contributor

Yii::setAlias('tests', realpath(__DIR__ . '/../tests'));

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

nope, according to this - https://github.com/yiisoft/yii2/blob/master/apps/basic/tests/_bootstrap.php#L22. Anyway does not matter.

This comment has been minimized.

@creocoder

creocoder Jan 3, 2014

Contributor

realpath(__DIR__) === __DIR__ This is why you link did not show anything.

Now see whats really according:
https://github.com/yiisoft/yii2/blob/master/apps/advanced/common/config/params.php#L4

@creocoder

creocoder Jan 3, 2014

Contributor

realpath(__DIR__) === __DIR__ This is why you link did not show anything.

Now see whats really according:
https://github.com/yiisoft/yii2/blob/master/apps/advanced/common/config/params.php#L4

This comment has been minimized.

@cebe

cebe Jan 3, 2014

Member

should actually be changed this way:

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
@cebe

cebe Jan 3, 2014

Member

should actually be changed this way:

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');

This comment has been minimized.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

@creocoder i think i will be ignoring you. Thanks.
@cebe ok, will change.

@Ragazzo

Ragazzo Jan 3, 2014

Contributor

@creocoder i think i will be ignoring you. Thanks.
@cebe ok, will change.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

Done, can be reviewed.

Contributor

Ragazzo commented Jan 3, 2014

Done, can be reviewed.

cebe added a commit that referenced this pull request Jan 3, 2014

Merge pull request #1759 from Ragazzo/fixtures_controller_improvements
Added to the basic app, fixed config, added to core commands.

@cebe cebe merged commit 08ee8b1 into yiisoft:master Jan 3, 2014

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Jan 3, 2014

Member

Thanks!

Member

cebe commented Jan 3, 2014

Thanks!

@Ragazzo Ragazzo deleted the Ragazzo:fixtures_controller_improvements branch Jan 3, 2014

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 3, 2014

Contributor

@cebe also change alias to dirname in tests/_bootstrap.php. Thanks.

Contributor

Ragazzo commented Jan 3, 2014

@cebe also change alias to dirname in tests/_bootstrap.php. Thanks.

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Jan 3, 2014

Member

tests/_bootstrap.php is already fine.

Member

cebe commented Jan 3, 2014

tests/_bootstrap.php is already fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment