stephpy/timeline-bundle

Error in basic example.

Closed this issue · 10 comments

I try use the basic example:
https://github.com/stephpy/TimelineBundle/blob/master/Resources/doc/basic_example.markdown

When I render the view show this result, only a minus

 -

If I print $timeline object whit ladybug:

object(Spy\TimelineBundle\Driver\ORM\Pager)
-Data
    [*items]: array(1)
         [0]: object(chatea\ChatBundle\Entity\Action)
    [*lastPage]: int 1
    [*page]: int 1
    [*nbResults]: int 1
+Class info
+Methods

Does anyone know what's going on?

Thanks

Hi, can you dump the action please ?

foreach ($timeline as $action) {
// dump $action
}

It seems Action is empty (have not components loaded).

I would like to find time to improve the basic example, i cannot at this time :( sorry.

In action, you should have

$action->getSubject(); // return Component
$action->getComponent('directComplement'); // return Component
$action->getVerb();

Dump theses lines ;)

There is no subject, component or verb,

Also the controller:

    public function myAction()
    {
        $actionManager   = $this->get('spy_timeline.action_manager');
        $timelineManager = $this->get('spy_timeline.timeline_manager');
        $subject         = $actionManager->findOrCreateComponent('\User', 'steven seagal');

        $timeline = $timelineManager->getTimeline($subject);

        //$countEntries = $timelineManager->countEntries($subject);   //this metod not exist

        return array('coll' => $timeline);
    }

error-timeline

Thanks.

btw there is a verb, try to dump $action->getComponent('directComplement'), $action->getSubject();

It should return a Entity\Component instance which should have ->model property and identifier which is hydrated.

I dump the directComponent, subject and verb in the controller and works fine.

But I try show in the view and I only get the subject.

control.twig.html

<hr>
The verb {{ timeline_component_render(timeline, 'verb') }}
<hr>
DirectCompnent {{ timeline_component_render(timeline, 'directComponent') }}
<hr>
Subject
{{ timeline_component_render(timeline, 'subject') }}

The result:

<hr>
The verb <span class="verb"></span>

<hr>
DirectCompnent <span class="directComponent"></span>

<hr>
Subject
<span class="subject">borja</span>

Thanks.

Weird, it should be an issue, verb and directComponent should be showed, i'll look at this as soon as possible.

I cannot reproduce this issue, for verb, try {{ timeline.verb }}, and directComplement, it's weird, try this on template {{ timeline.getComponent('directComponent').text }}

I created a demo application: https://github.com/stephpy/timeline-app If it can help you.

ps: if you make {{ timeline_component_render(timeline, 'directComplement') }} and directComplement does not exists it'll create an empty <span class="directComplement"></span>

Can it be a typo ?

Now it works fine. It would have a problem with hydrator in my proyect.

I really like the bundle, I try to work on it.

Thanks

Thank you ;) If you have any other question/issue, feel free to create a new issue.