Skip to content

Commit

Permalink
Make Yarak::call accept DI interface instead of concrete class.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleigh committed Mar 14, 2017
1 parent 486d1e3 commit 9f49ce5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ php yarak migrate --refresh
### Calling Yarak In Code
To call a Yarak command from your codebase, use the Yarak::call static method.
```php
public static function call($command, array $arguments = [], FactoryDefault $di = [])
public static function call($command, array $arguments = [], \Phalcon\DiInterface $di = [])
```
For example, to call `migrate --rollback --steps=2`:
```php
Expand All @@ -654,8 +654,11 @@ Yarak::call('migrate', [

Yarak will attempt to resolve its config from /app/config/service.php. If your services file is in a different location, you will need to pass an instance of $di manually.
```php
use Phalcon\DI;
use Yarak\Yarak;

$di = DI::getDefault();

Yarak::call('migrate', [
'--rollback' => true,
'--steps' => 2,
Expand Down
3 changes: 2 additions & 1 deletion src/Yarak.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Yarak;

use Phalcon\DiInterface;
use Phalcon\Di\FactoryDefault;
use Yarak\Exceptions\FileNotFound;
use Symfony\Component\Console\Input\ArrayInput;
Expand All @@ -16,7 +17,7 @@ class Yarak
* @param array $arguments Argument array.
* @param FactoryDefault $di DI, may be necessary for php 5.6.
*/
public static function call($command, array $arguments = [], FactoryDefault $di = null)
public static function call($command, array $arguments = [], DiInterface $di = null)
{
$kernel = self::getKernel($di);

Expand Down

0 comments on commit 9f49ce5

Please sign in to comment.