Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Passback To DIC #14342

Merged
merged 2 commits into from Sep 12, 2019

Conversation

@Fenikkusu
Copy link
Contributor

Fenikkusu commented Aug 29, 2019

Hello!

  • Type: new feature

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:

I often find myself having to do the following:

use Phalcon\Di;
use Other;
use Another;

$di = new Di();

$di->set('name', function () {
   return $this->get(Other::class);
});

if (true) {
     $di->set(Other::class, Another::class);
}

This PR eliminates the extra steps by letting the service class instantiate through the DIC. I can now right the code as:


use Phalcon\Di;
use Other;
use Another;

$di = new Di();

$di->set('name', Other::class);
if (true) {
     $di->set(Other::class, Another::class);
}

Thanks

@codecov

This comment has been minimized.

Copy link

codecov bot commented Aug 29, 2019

Codecov Report

Merging #14342 into 4.0.x will decrease coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##            4.0.x   #14342      +/-   ##
==========================================
- Coverage   67.78%   67.77%   -0.01%     
==========================================
  Files         478      478              
  Lines      112924   112927       +3     
==========================================
- Hits        76549    76541       -8     
- Misses      36375    36386      +11
@sergeyklay

This comment has been minimized.

Copy link
Member

sergeyklay commented Aug 29, 2019

Related to #13042

@sergeyklay

This comment has been minimized.

Copy link
Member

sergeyklay commented Aug 29, 2019

@niden

This comment has been minimized.

Copy link
Member

niden commented Sep 7, 2019

@Fenikkusu could you please add an entry in the CHANGELOG-4.0 please?

@niden

This comment has been minimized.

Copy link
Member

niden commented Sep 7, 2019

and rebase

@niden niden added 4.0 and removed 4.1 labels Sep 7, 2019
@niden niden added this to In progress in 4.0 Release via automation Sep 7, 2019
@Fenikkusu Fenikkusu force-pushed the twistersfury:4.0.x-di-alias branch from 19b9868 to 772a002 Sep 8, 2019
@Fenikkusu

This comment has been minimized.

Copy link
Contributor Author

Fenikkusu commented Sep 8, 2019

Done

@Fenikkusu Fenikkusu dismissed stale reviews from Jeckerson, ruudboon, and sergeyklay via 0e1b3e8 Sep 11, 2019
@niden niden merged commit 0e1b3e8 into phalcon:4.0.x Sep 12, 2019
4 checks passed
4 checks passed
codecov/patch Coverage not affected when comparing 47cd4a7...0e1b3e8
Details
codecov/project 67.77% (-0.01%) compared to 47cd4a7
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
4.0 Release automation moved this from In progress to Done Sep 12, 2019
@niden

This comment has been minimized.

Copy link
Member

niden commented Sep 12, 2019

@Fenikkusu Thank you!

@Fenikkusu Fenikkusu deleted the twistersfury:4.0.x-di-alias branch Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4.0 Release
  
Done
5 participants
You can’t perform that action at this time.