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

Evaluated Kdyby_Doctrine_IamTheKingOfHackingNette_* removed #274

Closed
wants to merge 2 commits into from

Conversation

hranicka
Copy link
Contributor

@hranicka hranicka commented May 31, 2016

Hi Filip,

First, thank you for a great Nette extension Kdyby/Doctrine!

But I've got some kind of problems when I register a repository as a service (i.e. in a config file).

The reason is DIC is evaluated at a compile time here.

The problem is that some code is lauchned twice (i.e. Kdyby\Events Tracy Panel registration).

It's a problem only at a compile-time, but I've had another issue and my DIC was rebuilt for every application request (in a debug mode only).


I've refactored the code and removed DIC evaluating at a compile-time.

Because there are some expensive operations and now the code is launched at a run-time, I've added caching in there.

Now the code in a production should be as fast as previously (DIC evaluating and generated PHP class changes vs. repository mapping and caching the map). And DIC is evaluated as should be - only at runtime.

What do you think?

$this->map = $this->cache->load($containerFile);

if ($this->map === NULL) {
foreach ($queue as $manager => $items) {
Copy link
Contributor Author

@hranicka hranicka May 31, 2016

Choose a reason for hiding this comment

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

This is extracted code from OrmExtension with minor changes
($config = $this->managerConfigs[$manager]; -> $repository = $classNames[$manager];).

@hranicka
Copy link
Contributor Author

Tests failing on Nette 2.3-dev because of this.

@fprochazka
Copy link
Member

Wow, this is a big change. But... I've come to a conclusion, that this magic for the repositories is wrong :) So I'm gonna be removing it entirely in v4.0.

I'm not sure I wanna be changing this in 3.1.* throught.

@fprochazka
Copy link
Member

You should bypass the magic by declaring the metadata it tries to read from "runtime" by compiling the container. This is going to be removed from Kdyby.

@fprochazka fprochazka closed this Mar 8, 2017
@fprochazka
Copy link
Member

fprochazka commented Mar 8, 2017

Sorry, but I can't merge this, as it would complicate the process for me.

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.

2 participants