Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

ResourceEvent should be optional in query filters and providers #280

Open
jguittard opened this issue Oct 25, 2016 · 4 comments
Open

ResourceEvent should be optional in query filters and providers #280

jguittard opened this issue Oct 25, 2016 · 4 comments

Comments

@jguittard
Copy link
Contributor

As a concrete example, let's say an entity has to be created from an RPC controller. A DoctrineResource::create method is then called. Thus, when calling it, data is filtered through a ZF\Apigility\Doctrine\Server\Query\CreateFilter\DefaultCreateFilter (by default, should no extra configuration provided) as shown here

  • In this concrete class (DefaultCreateFilter), the event is not used at all.
  • Although filtering is mandatory through the DoctrineResource::create implementation, the event may not be available.
  • That should not stopped the process of creating an entity through its dedicated Resource.
jguittard added a commit to jguittard/zf-apigility-doctrine that referenced this issue Oct 25, 2016
@michalbundyra
Copy link
Member

@jguittard DoctrineResource extends AbstractResourceListener and method create is not called directly but via dispatch method so the event is there always available.

Can you show example when the event is not available in create method?

@gsomoza
Copy link
Contributor

gsomoza commented Feb 4, 2017

I think he meant if you call DoctrineResource::create() directly since it's a public function. Maybe the API for the class can be simplified to avoid confusion by making the methods of that type protected in the future (but it's a BC break)

@michalbundyra
Copy link
Member

Oh, yeah, this is what he meant probably :) Thanks @gsomoza. I misunderstood. Sorry @jguittard :)

I have a lot of concerns about PR #281 and it seems to be also BC Break.
We can't change these methods to protected - as these are from ZF\Rest\AbstractResourceListener.

I'm afraid that the library doesn't support RPC endpoints at all right now. There is something in codebase already (DoctrineRpcServiceModel, ...), so before somebody has it in mind. Maybe we can add it.

Of course it will be nice to resolve also this issue somehow, to allow usage create/fetch/patch/... methods without the event. Hm... what if we override getEvent method to returns always ResourceEvent?

@jguittard @gsomoza thoughts?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-doctrine; a new issue has been opened at laminas-api-tools/api-tools-doctrine#7.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants