Skip to content

Conversation

hannesvdvreken
Copy link
Contributor

vagrant@precise64:/vagrant$ php artisan tinker
[1] > require_once('app/database/migrations/2014_03_03_163401_refactor_token_table.php');
[2] > App::make('RefactorTokenTable');
// object(RefactorTokenTable)(
// 
// )
[3] >

https://github.com/laravel/framework/blob/4.1/src/Illuminate/Database/Migrations/Migrator.php#L291-L297

It is perfectly doable to apply constructor injection.

@crynobone
Copy link
Member

Shouldn't it just typehint to Illumintae\Container\Container, which make it work nicely outside of Laravel.

@hannesvdvreken
Copy link
Contributor Author

@crynobone
Copy link
Member

Yeah, and line 60 obviously.

There no need to change the service provider part since that is only used on Laravel.

@hannesvdvreken
Copy link
Contributor Author

Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with the spacing here? Doc blocks should have 1 tab, then one space, then a *, then a space, then text. You are missing that space after the tab. Note when we start with a /**, we don't need that space,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix the missing spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was testing Atom editor but it didn't handle doc blocks well. I overlooked the awkwardly wrong doc blocks. Fixed it! Thanks!

@GrahamCampbell
Copy link
Collaborator

👍 Could you squash this please? :P

@taylorotwell
Copy link
Member

Personally I wonder if you should be using a command or something. I don't particularly understand the need to dependency inject into a migration. You could just use App::make to resolve something in the migration.

@hannesvdvreken
Copy link
Contributor Author

App::make is what I did.
Had to pull in extra meta data for filling up columns in a table after a migration.

I was surprised that it didn't do auto DI via constructor.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants