Git Product home page Git Product logo

Comments (11)

ozahorulia avatar ozahorulia commented on September 23, 2024 2

Same here, but in different context

User Deprecated: Method Doctrine\ORM\Event\OnFlushEventArgs::getEntityManager() is deprecated and will be removed in Doctrine ORM 3.0. Use getObjectManager() instead. (OnFlushEventArgs.php:34 called by ORM.php:98, https://github.com/doctrine/orm/issues/9875, package doctrine/orm)

from doctrineextensions.

pculka avatar pculka commented on September 23, 2024 2

Any possible updates on this?

from doctrineextensions.

stof avatar stof commented on September 23, 2024 2

This is not deprecated in Doctrine itself. However, Symfony has deprecated registering Doctrine subscribers because they cannot be lazy-loaded (contrary to Symfony subscribers, the Doctrine ones require instantiating the object to get the list of subscribed events).

In https://packagist.org/packages/stof/doctrine-extensions-bundle, I already updated the way listeners are registered to be compatible with this lazy-loading (include tests that will ensure that the explicit registration is in sync with the library subscriber).
If you manage the listener yourselves instead of using the bundle, you need to manage the registration yourselves.

from doctrineextensions.

LaurentSanson avatar LaurentSanson commented on September 23, 2024 1

@mcanepa ,

You could just remove the call to annotation reader that you've set in your config file, or better option, use the @stof 's bundle properly and in hisstof_doctrine_extensions_yamlset something like this :

# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
# See the official DoctrineExtensions documentation for more details: https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc
stof_doctrine_extensions:
    default_locale: fr_FR
    orm:
        default:
            timestampable: true
            sluggable: true

It should works just fine

from doctrineextensions.

LaurentSanson avatar LaurentSanson commented on September 23, 2024

Waiting for any update too

from doctrineextensions.

LaurentSanson avatar LaurentSanson commented on September 23, 2024

Just found my answer in the documentation : https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/symfony.md#doctrine-extension-listener-services

Needed to update the config in services.yaml

from doctrineextensions.

mcanepa avatar mcanepa commented on September 23, 2024

@LaurentSanson I get

The service "gedmo.listener.tree" has a dependency on a non-existent service "annotation_reader"

how did you solve it?

from doctrineextensions.

mcanepa avatar mcanepa commented on September 23, 2024

@LaurentSanson I did both:

In config/services.yaml I removed

        calls:
            - [ setAnnotationReader, [ "@annotation_reader" ] ]

and instead of using

    gedmo.listener.timestampable:
        class: Gedmo\Timestampable\TimestampableListener
        tags:
            - { name: doctrine.event_listener, event: 'prePersist' }
            - { name: doctrine.event_listener, event: 'onFlush' }
            - { name: doctrine.event_listener, event: 'loadClassMetadata' }

I used config/stof_doctrine_extensions.yaml

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default:
            timestampable: true

now TimestampableEntity trait works but only for POST operation, it fails on PUT. I get

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'created_at' cannot be null"

from doctrineextensions.

LaurentSanson avatar LaurentSanson commented on September 23, 2024

I think you can get rid of the calling of timestampable in your services.yaml as it is enabled in stof_doctrine_extensions.yaml

from doctrineextensions.

github-actions avatar github-actions commented on September 23, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from doctrineextensions.

oleg-andreyev avatar oleg-andreyev commented on September 23, 2024

#2704 (comment)

from doctrineextensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.