Skip to content

[Loggable] ODM undefined method "scheduleExtraUpdate" of UnitOfWork #2971

@mbraeuner

Description

@mbraeuner

Environment

its a php:8.2.28-fpm docker image. with symfony 7.2

Package

show

$ composer show --latest gedmo/doctrine-extensions
name     : gedmo/doctrine-extensions
descrip. : Doctrine behavioral extensions
keywords : Blameable, behaviors, doctrine, extensions, gedmo, loggable, nestedset, odm, orm, sluggable, sortable, timestampable, translatable, tree, uploadable
versions : * v3.20.0
released : 2025-04-04, 3 months ago
latest   : v3.20.0 released 2025-04-04, 3 months ago
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : http://gediminasm.org/
source   : [git] https://github.com/doctrine-extensions/DoctrineExtensions.git ea1d37586b8e4bae2a815feb38b177894b12c44c
dist     : [zip] https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/ea1d37586b8e4bae2a815feb38b177894b12c44c ea1d37586b8e4bae2a815feb38b177894b12c44c
path     : /home/www/vendor/gedmo/doctrine-extensions
names    : gedmo/doctrine-extensions

support
docs : https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc
issues : https://github.com/doctrine-extensions/DoctrineExtensions/issues
source : https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.20.0

autoload
psr-4
Gedmo\ => src/

requires
behat/transliterator ^1.2
doctrine/collections ^1.2 || ^2.0
doctrine/deprecations ^1.0
doctrine/event-manager ^1.2 || ^2.0
doctrine/persistence ^2.2 || ^3.0 || ^4.0
php ^7.4 || ^8.0
psr/cache ^1 || ^2 || ^3
psr/clock ^1
symfony/cache ^5.4 || ^6.0 || ^7.0

requires (dev)
doctrine/annotations ^1.13 || ^2.0
doctrine/cache ^1.11 || ^2.0
doctrine/common ^2.13 || ^3.0
doctrine/dbal ^3.7 || ^4.0
doctrine/doctrine-bundle ^2.3
doctrine/mongodb-odm ^2.3
doctrine/orm ^2.20 || ^3.3
friendsofphp/php-cs-fixer ^3.70
nesbot/carbon ^2.71 || ^3.0
phpstan/phpstan ^2.1.1
phpstan/phpstan-doctrine ^2.0.1
phpstan/phpstan-phpunit ^2.0.3
phpunit/phpunit ^9.6
rector/rector ^2.0.6
symfony/console ^5.4 || ^6.0 || ^7.0
symfony/doctrine-bridge ^5.4 || ^6.0 || ^7.0
symfony/phpunit-bridge ^6.0 || ^7.0
symfony/uid ^5.4 || ^6.0 || ^7.0
symfony/yaml ^5.4 || ^6.0 || ^7.0

suggests
doctrine/mongodb-odm to use the extensions with the MongoDB ODM
doctrine/orm to use the extensions with the ORM

conflicts
doctrine/annotations <1.13 || >=3.0
doctrine/common <2.13 || >=4.0
doctrine/dbal <3.7 || >=5.0
doctrine/mongodb-odm <2.3 || >=3.0
doctrine/orm <2.20 || >=3.0 <3.3 || >=4.0

Doctrine packages

show

$ composer show --latest 'doctrine/*'
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "7.2.*"
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package behat/transliterator is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
115 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [OK]
Executing script assets:install public [OK]

No security vulnerability advisories found.
marco@netbook:/home/www/pimL/nice$ bin/composer show --latest 'doctrine/*'
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
- up to date version

Direct dependencies required in composer.json:
doctrine/doctrine-bundle            2.15.0 2.15.0 Symfony DoctrineBundle
doctrine/doctrine-migrations-bundle 3.4.2  3.4.2  Symfony DoctrineMigrationsBundle
doctrine/mongodb-odm-bundle         5.3.1  5.3.1  Symfony Doctrine MongoDB Bundle
doctrine/orm                        3.5.0  3.5.0  Object-Relational-Mapper for PHP

Transitive dependencies not required in composer.json:
doctrine/cache                      2.2.0  2.2.0  PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections                2.3.0  2.3.0  PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/dbal                       4.3.0  4.3.0  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations               1.1.5  1.1.5  A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/event-manager              2.0.1  2.0.1  The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                  2.0.10 2.0.10 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator               2.0.0  2.0.0  A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                      3.0.1  3.0.1  PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                 3.9.1  3.9.1  PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema...
doctrine/mongodb-odm                2.11.2 2.11.2 PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.
doctrine/persistence                4.0.0  4.0.0  The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter              1.5.2  1.5.2  a PHP SQL highlighting library

PHP version

$ php -v
PHP 8.2.28 (cli) (built: May 21 2025 23:17:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
    with Xdebug v3.4.3, Copyright (c) 2002-2025, by Derick Rethans

Subject

When changing property and flushing my mongodb ODM document I get an exception
Attempted to call an undefined method named "scheduleExtraUpdate" of class "Doctrine\ODM\MongoDB\UnitOfWork"

my entity is
#[Gedmo\Loggable]

my property is a
#[ODM\ReferenceOne(nullable: true, storeAs: 'id', targetDocument: MyDocument::class, cascade: ['persist', 'detach'])]
#[Gedmo\Versioned]

Expected results

saving the changed id of the referenced Document in change log db

I found pull request #1346 where the scheduleExtraUpdate was wrapped into an if for the ORM case of the SoftDeletable listener.
I'm confused after reading issue #1333 with same Exception. It seems that it was fixed in former.

Actual results

In LoggableListener.php line 194:
                                                                                                                 
  [Symfony\Component\ErrorHandler\Error\UndefinedMethodError]                                                    
  Attempted to call an undefined method named "scheduleExtraUpdate" of class "Doctrine\ODM\MongoDB\UnitOfWork".  
  Did you mean to call e.g. "isScheduledForUpdate" or "scheduleForUpdate"?                                       

Stacktrace

LoggableListener.php:194, Gedmo\Loggable\LoggableListener->postPersist()
ContainerAwareEventManager.php:56, Symfony\Bridge\Doctrine\ContainerAwareEventManager->dispatchEvent()
LifecycleEventManager.php:303, Doctrine\ODM\MongoDB\Utility\LifecycleEventManager->dispatchEvent()
LifecycleEventManager.php:91, Doctrine\ODM\MongoDB\Utility\LifecycleEventManager->postPersist()
UnitOfWork.php:1213, Doctrine\ODM\MongoDB\UnitOfWork->executeUpserts()
UnitOfWork.php:3115, Doctrine\ODM\MongoDB\UnitOfWork->doCommit()
UnitOfWork.php:472, Doctrine\ODM\MongoDB\UnitOfWork->commit()
DocumentManager.php:585, Doctrine\ODM\MongoDB\DocumentManager->flush()
VerifyCommand.php:200, App\Command\VerifyCommand->execute()
Command.php:279, Symfony\Component\Console\Command\Command->run()
Application.php:1094, Symfony\Component\Console\Application->doRunCommand()
Application.php:123, Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
Application.php:342, Symfony\Component\Console\Application->doRun()
Application.php:77, Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
Application.php:193, Symfony\Component\Console\Application->run()
ConsoleApplicationRunner.php:49, Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
autoload_runtime.php:29, require_once()
console:11, {main}()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA confirmed bug in Extensions that needs fixing.Loggable

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions