stephpy / timeline-bundle

Symfony2 bundle to make timeline
192 stars 57 forks source link

When User:1 writes on User:2 wall #177

Closed robbanl closed 7 years ago

robbanl commented 9 years ago

Hi,

How am I suppose to write on someone else's wall?

User:1 "say" Hello to User:2.

This is what I'm using for writing on my own wall:

            $action = $actionManager->create(
                $subject,
                'say',
                array(
                    'directComplement' => $data->getComplementText()
                )
            );
            $actionManager->updateAction($action);

Or, when replying to entries (if possible)? How to do that :)

Thanks alot for your help. Wish I could buy you a beer!

stephpy commented 9 years ago

Hi,

You have to look at spread system, by default, creating an action will deploy this one on subject wall. But you could spread this action in any other component.

See Documentation

By this way, you will be able easily to spread to USER 2, and if you want to create a new action which is an answer to first one, you're free to do something like that.

$action = $actionManager->create(
                $subject,
                'say',
                array(
                    'directComplement' => $data->getComplementText(),
// you have to transform previousAction as component before.
                    'answer_to' => $previousAction
                )
            );
            $actionManager->updateAction($action);

With this case, only one problem, your answer_to component will be hydrated but not sure components of this one will be ... It's a new use case, never thought to this.

:beers: ;)