zfcampus/zf-apigility-doctrine

EVENT_FETCH_PRE Not Fired as Doctrine Resource Event

Closed this issue · 6 comments

All of the events within DoctirneResource fire with triggerDoctrineEvent, except one of them, EVENT_FETCH_PRE.

This seems to be a bug. Before submitting a pull request, i would like to know if there is any reason why it was done this way?

The function triggerDoctrineEvent takes the entity as the second argument.

https://github.com/zfcampus/zf-apigility-doctrine/blob/master/src/Server/Resource/DoctrineResource.php#L507

At the time EVENT_FETCH_PRE is composed the entity does not exist.

Ok, i see now, would there be an issue with adding the ResourceEvent to EVENT_FETCH_PRE?

You're asking me to imagine code; it would be clearer if you made a PR so we can see what you're proposing.

From your last post I can only say that the ResourceEvent is composed and fired as the actual triggered event of the EVENT_FETCH_PRE event.

It's specifically the Zf\Rest\ResourceEvent object that is missing from the event. See #316.

This is the line that you've added which is missing:

$event->setResourceEvent($this->getEvent());

I think you did find a bug and I'd like to see your PR approved.

However I don't know the status of the people who maintain this repository.
@webimpress @weierophinney is approving this PR and making a release in the cards this year?

This was fixed and released, so it can be closed now. @TomHAnderson @weierophinney @webimpress Thanks for your help.