sonata-project / SonataTimelineBundle

[Abandoned] Integrates SpyTimelineBundle into Sonata
https://docs.sonata-project.org/projects/SonataTimelineBundle
MIT License
24 stars 35 forks source link

Error: Class Application\Sonata\TimelineBundle\Entity\Timeline has no association named action #261

Closed tomasyhy closed 4 years ago

tomasyhy commented 4 years ago

Environment

Sonata packages

sonata-project/admin-bundle              3.55.0 3.63.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.5 3.19.0 Symfony SonataBlockBundle
sonata-project/cache                     1.1.1  2.0.1  Cache library
sonata-project/cache-bundle              2.4.2  3.2.1  This bundle provides caching services
sonata-project/classification-bundle     3.7.1  3.11.1 Symfony SonataClassificationBundle
sonata-project/core-bundle               3.17.2 3.17.2 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0  2.5.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.6.0  1.6.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.13.0 3.15.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.11.1 1.11.1 Lightweight Exporter library
sonata-project/formatter-bundle          3.5.0  4.1.3  Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.7.0  2.7.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.16.3 3.25.0 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.6.2  3.7.0  Symfony SonataNotificationBundle
sonata-project/page-bundle               3.13.0 3.16.0 This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.10.0 2.10.0 Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.4.0  3.5.0  Integrates SpyTimelineBundle into Sonata
sonata-project/user-bundle               4.5.1  4.5.3  Symfony SonataUserBundle

Symfony packages

symfony/monolog-bundle     v3.2.0  v3.5.0  Symfony MonologBundle
symfony/phpunit-bridge     v2.8.52 v5.1.2  Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.17.1 v1.17.1 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype     v1.17.1 v1.17.1 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu  v1.17.1 v1.17.1 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn  v1.17.1 v1.17.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring  v1.17.1 v1.17.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.17.1 v1.17.1 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.17.1 v1.17.1 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72     v1.17.0 v1.17.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-util      v1.17.1 v1.17.1 Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.4  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.7  v3.4.0  Symfony SwiftmailerBundle
symfony/symfony            v3.4.0  v3.4.42 The Symfony PHP framework

PHP version

PHP 7.1.2 (cli) (built: Feb 28 2017 17:50:42) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.2, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans

Subject

Steps to reproduce

  1. Go to /admin/dashboard

Actual results

Error occurs:

An exception has been thrown during the rendering of a template ("[Semantical Error] line 0, col 96 near 'a LEFT JOIN a.actionComponents': Error: Class Application\Sonata\TimelineBundle\Entity\Timeline has no association named action").

I followed by doc from https://sonata-project.org/bundles/timeline/3-x/doc/reference/installation.html I've seen similar topic https://github.com/sonata-project/SonataTimelineBundle/issues/30 But it doesn't help me. I have correct config files from doc:

sonata_timeline.yml

sonata_timeline:
    manager_type: orm
    class:
        user:             '%sonata.user.admin.user.entity%'
        timeline:         '%spy_timeline.class.timeline%'
        action:           '%spy_timeline.class.action%'
        component:        '%spy_timeline.class.component%'
        action_component: '%spy_timeline.class.action_component%'

spy_timeline.yml

spy_timeline:
    drivers:
        orm:
            object_manager: doctrine.orm.entity_manager
            classes:
                query_builder: ~ # Spy\TimelineBundle\Driver\ORM\QueryBuilder\QueryBuilder
                timeline:         Application\Sonata\TimelineBundle\Entity\Timeline
                action:           Application\Sonata\TimelineBundle\Entity\Action
                component:        Application\Sonata\TimelineBundle\Entity\Component
                action_component: Application\Sonata\TimelineBundle\Entity\ActionComponent

    filters:
        data_hydrator:
            priority:             20
            service:              spy_timeline.filter.data_hydrator
            filter_unresolved:    false
            locators:
                - spy_timeline.filter.data_hydrator.locator.doctrine_orm

Any idea what can be wrong?

manuelschulte commented 4 years ago

Hi, @tomasyhy, could you please explain how you solved the problem? I have the same issue and can't get it to work. Thanks in advance.

tomasyhy commented 4 years ago

Hi, if I remember correctly problem was with the incorrect User entity class. Check if you have correctly set "user" property in "sonata_core.yml" Here is my file:

sonata_user:
    class:
        group:  AppBundle\Entity\Admin\Group
        user:  AppBundle\Entity\User

My AppBundle\Entity\User class extends Sonata\UserBundle\Entity\BaseUser

manuelschulte commented 4 years ago

Hi @tomasyhy thanks for your quick response.

Unfortunately the "user" property was already set to the correct entity classes and both extend the sonata user bundle classes. So the root of the problem must be somewhere else. Maybe I can figure it out by myself this afternoon.

Tadek888 commented 3 years ago

Hi! Someone could help ? I have the same problem.

michelerusso commented 3 years ago

Same problem here... please, help.

wbloszyk commented 3 years ago

You should set classes in sonata_timeline too (with user):

spy_timeline:
    drivers:
        orm:
            object_manager: doctrine.orm.entity_manager
            classes:
                query_builder: ~ # Spy\TimelineBundle\Driver\ORM\QueryBuilder\QueryBuilder
                timeline:         App\Entity\SonataTimelineTimeline
                action:           App\Entity\SonataTimelineAction
                component:        App\Entity\SonataTimelineComponent
                action_component: App\Entity\SonataTimelineActionComponent

sonata_timeline:
    manager_type: orm
    class:
        user: App\Entity\SonataUserUser
        timeline: App\Entity\SonataTimelineTimeline
        action: App\Entity\SonataTimelineAction
        component: App\Entity\SonataTimelineComponent
        action_component: App\Entity\SonataTimelineActionComponent