Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments about EventHandlerInspector #4

Open
prolic opened this issue Feb 19, 2017 · 11 comments
Open

Comments about EventHandlerInspector #4

prolic opened this issue Feb 19, 2017 · 11 comments

Comments

@prolic
Copy link
Member

prolic commented Feb 19, 2017

see: https://github.com/mrook/annotations/blob/master/src/EventHandlerInspector.php#L29-L40

can't that be done lazy within findMessageInvoker() method?

@mrook
Copy link
Contributor

mrook commented Feb 20, 2017

Possibly, reason I'm doing it here is because of the implementation of doctrine-annotations. With a better cache setup, we could think of a lazy inspect.

@codeliner
Copy link
Member

only short reminder for later, because I have no time atm to valide it:
I've added a feature to disco recently. Disco uses doctrine-annotations to set up a DIC. Besides that, it uses ProxyManager for lazy loading. Maybe same combination can help us here? /cc @shochdoerfer @Ocramius

@Ocramius
Copy link

You need to split compile and runtime anyway, as otherwise this stuff is going to be terribly slow

@shochdoerfer
Copy link

Not sure what is needed but a feature I have in mind for Disco since a while is this: Basically a change to allow to register custom annotations that generate code for custom wirings, e.g. to easily configure routings or security ACLs. Might also work for this case.

@mrook
Copy link
Contributor

mrook commented Jun 12, 2017

@codeliner could be potentially useful, I don't know disco so I can't really say.

@codeliner
Copy link
Member

yeah, I thought of it more like a reference implementation using annotations + proxymanager.
I don't know how Symfony handles all those bundle annotations. They all need to be cached somehow.
@prooph/symfony-team Does anyone know that?

A global annotation compiler + cache would be nice. Some prooph users also want to use JMS Serializer for payload serialization. If you want to go the annotation way you could use Disco as DIC + JMS + prooph/annotations and get a nice annotation-driven framework.

At the moment I'm really looking for ways to make working with prooph easier. Once you've understood the different parts and how to use them prooph is just great, but getting there is hard.
I worked on a side-project with exactly that goal: event-machine
It uses a programmatic approach rather than an annotation approach, but in the end both have the same goal: reduce boilerpate, increase development speed and improve experience

Turning a POPO into an aggregate with just a few annotations is great and could really help to understand some bits of Event Sourcing more easily. So I hope we find a good way to make it production-ready.

@Ocramius
Copy link

I don't know how Symfony handles all those bundle annotations. They all need to be cached somehow.

There's a cache warmup for non-container stuff, and the container itself is usually dumped as plain php

@codeliner
Copy link
Member

@Ocramius thx!
I'm wondering how annotation parsing is organized?
You need to point Doctrine to the entity directory and then Doctrine parses all entity files in there.
Disco needs to be pointed to an annotated configuration class.
How does a Symfony bundle know where controllers are located to parse REST, ROUTE or ApiDOC annotations for example? Is it based on conventions like controllers are always located in MyBundle\Controller ?

I'm looking for a way that could work for us:

  • configuration: tell annotation parser about all annotated classes
  • conventions: aggregates are in Model/, commands are in Command/, ....
  • scan all files of the project
  • tbd

@UFOMelkor
Copy link
Member

AFAIK controllers must be registered in the routing. See http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html#activation

@UFOMelkor
Copy link
Member

Possible interesting too: The JMSDiExtraBundle (allows service injection via annotations) uses configuration to parse also non controller classes: http://jmsyst.com/bundles/JMSDiExtraBundle/master/configuration

@codeliner
Copy link
Member

great hints, thx @UFOMelkor

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

No branches or pull requests

6 participants