stephpy/timeline-bundle

Subject is null

Closed this issue · 7 comments

In rendering my wall, I don't understand why my subject is null :

- control - The world

Dump of my entry (the subject is indeed null) :

object(App\TimelineBundle\Entity\Action)[213]
  protected 'id' => int 6
  protected 'subject' => null
  protected 'subjectModel' => string 'App\UserBundle\Entity\User' (length=27)
  protected 'subjectId' => int 3

PHP for creating this entry :

$user = $em->getRepository('AppUserBundle:User')->find(3);
$entry = Action::create($user, 'control', 'The world');
$this->get('highco.timeline.manager')->push($entry);

I use "db_driver: redis" in my config.

Could you help me ?

Hi, I see,

If you use the db_driver: redis, the listener highco.timeline_listener which hydrates doctrine entity TimelineAction on postLoad is not defined.

Just define it as a service:

<service id="highco.timeline_listener" class="Highco\TimelineBundle\Entity\TimelineActionListener" public="false">
    <tag name="doctrine.event_subscriber" />
</service>

I guess i'll improve the documentation for this, or may use the DataHydrator later. ;)

I just add this in my services.yml :

highco.timeline_listener:
        class: Highco\TimelineBundle\Entity\TimelineActionListener
        public: false
        tags:
            - { name: doctrine.event_subscriber }

But it works not better :(

Just fixed on a1ae6c6

You have to define the filter: Data_Hydrator as defined on https://github.com/stephpy/TimelineBundle/blob/master/Resources/doc/filter.markdown

highco_timeline:
    filters:
        highco.timeline.filter.data_hydrator:
            options:
                db_driver: orm (only one supported actually)

I hope it'll be ok :)

I've updated my code and added this in my config :

    filters:
        highco.timeline.filter.data_hydrator:
            options:
                db_driver: redis

=> ServiceNotFoundException: The service "highco.timeline.filter.data_hydrator" has a dependency on a non-existent service "highco.timeline.entity_manager".

Fixed :\ sorry

Great, it works, with this 2 lines in the config :

    filters:
        highco.timeline.filter.data_hydrator:

Thanks ! I close the issue.

Just add a ~ because it's weird a key without value ;)

  filters:
        highco.timeline.filter.data_hydrator: ~

Thanks for you interest ;)