Based on Ocramius' blogpost.
syliuslabs / associationhydrator Goto Github PK
View Code? Open in Web Editor NEWDoctrine ORM hydration performance optimization made easier.
Doctrine ORM hydration performance optimization made easier.
Based on Ocramius' blogpost.
The issue to track and coordinate efforts.
just how to use it?
I see Symfony 6 compatibility is already present on master
, but those changes are not yet released. The latest version on Packagist is v1.1.4.
It would be nice if you could release a new version that includes these changes ๐
array_uniqe doesn't use strict comparison, which should always be used when comparing objects.
line 77: ->setParameter('subjects', array_unique($subjects, \SORT_REGULAR))
Hello,
I am not sure it is an issue, but I'd like to discuss it with you.
In my application I have an OrderItem with a ManyToOne Relation with another Entity called Child.
An OrderItem can have 0 or 1 child defined.
Now, in my orderRepository, I want to get OrderItems with child and its parent data, so I tried this way :
$this->associationHydrator->hydrateAssociations($order, [
'items',
'items.concernedChild.parent',
]);
But as concernedChild may be null I get an exception for this line of AssociationHydrator :
$subjects = array_map([$this->entityManager->getUnitOfWork(), 'getEntityIdentifier'], $subjects);
I managed to get it work by adding a simple filter on the $subjects array like this :
$subjects = array_filter($subjects, function ($subject) {
return $subject !== null;
});
What do you think ? is it normal that I get an Exception ? and is my solution valuable ?
Thanks !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.