stephpy/timeline-bundle

[2.0] Where is the wall

Closed this issue · 9 comments

Hi,

I can't find a "wall" equivalent in the 2.0 version. Is not yet implemented or am I just not getting it? :)

Thanks!

Hi @thomask, we changed terms on 2.0 : #53

$timelineManager->getTimeline($subject); //actions spread to subject
$actionManager->getSubjectActions($subject); // actions of subject.

;)

Thanks for the quick response! Have tried that ($timelineManager->getTimeline($subject)), but it returns two empty arrays. Can't find out why.

I'm also not really sure about the semantics. E.g. when I want to publish the fact that an event (entity, like a party or a conference) will be attended by one of my users (entity), I'm using the event as the subject and the user as the directComplement.

$action = $actionManager->create($even, 'attending_event',  array('directComplement' => $user));

Is that right? When I try it the other way around (subject = user, directComplement = event), I get an error:

Model has to be an object or a scalar + an identifier in 2nd argument

Any clues?

$event has to be an object or a Complement instance.

$event  = $actionManager->findOrCreateComponent($eventEntity); 
$action = $actionManager->create($event, 'attending_event',  array('directComplement' => 'scalar or object'));

// OR 
$action = $actionManager->create($eventEntity, 'attending_event',  array('directComplement' => 'scalar or object'));

// OR

$event  = $actionManager->findOrCreateComponent('a\model', array(1, 2));
$action = $actionManager->create($event, 'attending_event',  array('directComplement' => 'scalar or object'));

You have to define spreads for having a non empty results when call getTimeline.

timelineManager->getTimeline will return all actions where the subject is "connected". To define this subject as connected to an action, see spread section

If you have any other questions, you're welcome :)

Turns out that last error had to do with my spread logic being wrong when I swap the event and the user around.

However, I still get empty results, although I have a spread, and I can see a serialized php array of userIds who should receive the timeline update. Not really sure on how to proceed..

Are you using orm driver ? If yes, you can easily see which actions has to be shown when call ->getTimeline, that's stored on timeline table.

I guess the issue is on your spreads.

Jep I see an action in that table pointing to the event on the one hand and pointing to an array of userIds on the other. I would think that the user with those ids should be able to "see" the timeline actions right?

I'm not sure to understand what you say. see this example:

spy_timeline table:

id =  1
context= GLOBAL
type =  timeline
subject_id = 1
action_id = 1

spy_timeline_action:

id = 1 ..........

spy_timeline_component:

id = 1
model = toto
identifier = s:1:"1";

With this example, if you call:

$subject = $actionManager->findOrCreateComponent('toto', "1");
$actions  = $timelineManager->getTimeline($subject);
// it would return one action.

Ok got it working now. Thank you so much!

You're welcome ;)