Closed berdyshev closed 9 years ago
Hi,
Filter (DataHydrator) does not work in Spread classes. I never had this use case but you have to manually call DataHydrator or manually fetch entities.
Sorry, but why my case is special, so delivery: wait
option doesn't work for me?
Is this not a typical use case when I don't spread actions immediately, but using command spy_timeline:deploy
via cron, for example. For which cases this option should be used and how it works then?
Hi,
As I said
you have to manually call DataHydrator or manually fetch entities.
In spread class.
Sorry, but I can't understand the logic. As I understand, option delivery: wait
should have only one difference in the bundle's workflow: after some event occurred actions are delivered not immediately, but demand of console command spy_timeline:deploy
. That's all, imho! Spreading logic shouldn't depend on delivery type!
But as I'm understanding you replies, I should have different implementations of spread class for this two cases (immediate and deferred delivery of events). That's sounds weird. I think this is some kind of bug. Isn't it?
It's not kind of bug. It's written nowhere but in a spread class, you SHOULD NOT use components of the action which is spread.
If you use components of this action, on delivery immediate
, theses components are already defined and instanciated ... On delivery wait
, action is fetched from database and components aren't hydrated. That's the current issue.
I would have one advice ... It's to not use components of the action in spread classes.
Thank you Stéphane.
I thought that is common case to use components in spread, because usually (at least in my case) the users, which should receive certain events, depend on those components. For example, friends of the post author, "members" of some entity, etc.
I see, but you could fetch this component from your database instead of using action->getComponent.
Else we would have to use DataHydrator in spread when delivery: wait
and it's not useful in all cases to hydrate components of actions. IMO it's specific and the only one error done is to pass a full action object where you can get component data. You should fetch this data from database, by this way, you'll be able to pass from delivery wait
to immediate
without any problem.
Thanks. Added manual entity loading in spread class.
Hi.
I have empty database. Spread delivery set to
wait
andfilter_unresolved
set totrue
. When I run thedoctrine:fixtures:load
command to populate content, timeline actions also created for corresponding event (like following some entity, new post etc). But when I'm running after thatspy_timeline:deploy
command, I'm getting fatal error in my spread class —$action->getComponent('complement')->getData()
returnsNULL
.But when user performs some actions on the site after that (I commented
delivery: wait
config), all works fine — timeline actions are delivered correctly.I can't understand why component data is
NULL
in spread class with configdelivery: wait
. Do you have any thoughts on this point?