Update ORM Heap Cleaning Default Behavior #37
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces significant enhancements to the heap cleaning mechanism within the ORM factory. The primary focus is to provide more control over when and how heap cleaning occurs during entity creation.
Key Changes:
AbstractFactory::$cleanHeap
has been introduced. This property allows developers to control heap cleaning behavior at a global level.To change the heap cleaning behavior globally across all instances of the factory, set the
AbstractFactory::$cleanHeap
property. By default, heap cleaning is turned off.create
andcreateOne
methods now accept an optional$cleanHeap
parameter. This enables fine-grained control over heap cleaning for individual entity creation operations.Other changes
Enhancements to
__get
Method in ORM FactoryThis Pull Request introduces improvements to the
__get
magic method in our ORM Factory. We've added additional properties that can be accessed magically, namelydata
,entity
, andentities
. These enhancements simplify the process of obtaining different types of outputs from the factory, making the interface more intuitive and flexible for various use cases.1. Accessing
data
:You can now retrieve the raw data used for entity creation simply by accessing the
data
property. This is particularly useful for debugging or logging purposes.$rawData = $factory->data;
2. Accessing
entity
:Creating a single entity is now more straightforward. Accessing the
entity
property will trigger the creation of one entity based on the current factory state.$singleEntity = $factory->entity;
3. Accessing
entities
:Similarly, for creating multiple entities, you can use the
entities
property. It respects theamount
setting of the factory and returns an array of created entities.$multipleEntities = $factory->entities;