Repository navigation
Fixes property parsing being invoked inefficiently - #132
Conversation
|
Cool, thanks! I'll look at it tomorrow. Only one note - it breaks some tests, can you fix them? Just change $reflection = Abc::getReflection()to $reflection = Abc::getReflection();
$reflection->getEntityProperties();Thanks! |
|
I see. Now that the props are lazy loaded, the constructor does not trigger the errors. I will update the tests. Anyway, what is your configuration to run th tests? I did not find any info on running tests, or contributing in general. |
|
I use
|
|
I updated the failing test. I also added another optimization (I forgot to include it yesterday) that enables on-demand getter/setter initialization. The performance impact of it is not so remarkable, but removes some unncessary method name parsings. |
|
By the way, the tests fail using PHP 7.2.4: |
|
I'm also using this snippet in then it is very easy to just type |
Please also update
You read my mind :)
Have you latest version? It was fixed in 62a7363.
Yeah, the tests currently require |
- property parsing was being triggered multiple times for the same files, exponentially in relation to the ancestry depth
|
Sorry, guys. I did not realize that I had forked the repo before 🤣 I was thinking I was working on the latest version, because I clicked the fork button on the day I created the PR... @janpecha I believe the PR is now ready to be merged. |
|
@dakujem Can you squash commits into single commit with message (for example): Thanks! |
|
Hey, I thought GitHub offers this feature when merging. If not, let me know and I will squash. |
|
Yes, Github offers this feature, but from my point of view is better if author of PR prepare it because final commit is tested on CI once again before merging. Merged, thanks! |
|
I will do that next time. |
The problem:
The solution:
The result:
The test that shows the problem can be seen here:
https://github.com/dakujem/LeanMapper/blob/props-parsing-hell/tests/LeanMapper/EntityReflection.parsing.phpt
The tests for the fixed version can be found here:
https://github.com/dakujem/LeanMapper/blob/props-parsing-test/tests/LeanMapper/EntityReflection.parsing.phpt
I did not include the test intentionally, as it requires a static hook in the EntityReflection class or changing the visibility of methods in the class (private->protected). I am open to discussion.