Hi
Foreword
This weekend I have been putting the last touches in a project. In short terms, the project is about
- A endpoint collect a bunch of data
- It is saved directly to a database - no Flow involved here
- In my Flow app, i annotate a model class with
@ORM\Table(name='data')
and@Flow\Entity(readOnly=true)
- This model has a
OneToMany
relation to another table, that holds follow-up data via another (non-flow) rest service
I then give the registered user, a possibility to query these data set with parameters like
- Date start
- Date end
To create a range
and environments
which is a “context”, or a “group”, these data are saved in.
The issue
Some of the these data points can have thousands of relation in the @OneToMany
relation, to follow up data.
I try to use PaginateViewHelper
and pass on my QueryResultInterface
object, from my custom created qurey in my repository.
I of course annotate my @OneToMany
with a @Flow\Lazy
but at the time I start to render the datapoints in a list, the persistence layer, start hydrating all the objects, including the relations. Remember, there can be thousands in each of them. This causes a memory_limit error, and in our case, it gives the White Screen Of Death
I’m looking for suggestions on how to handle this properly, some ideas I’ve came up with my self would be
- Remove
@OneToMany
annotation and instead make the queries directly with it’s own Repository - eventually injected into the model - Go away from models and create custom queries, returning the column values, and then create a bunch of viewhelpers to make the template rendering smooth and easy.
All ideas and questions are welcome