DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

XML Validation Error with Doctrine 2.14.2

Open rufinus opened this issue 1 year ago • 8 comments

Environment

Package

Timestampable

$ 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.11.1
latest   : v3.11.1

Doctrine packages

$ composer show --latest 'doctrine/*'

Direct dependencies required in composer.json:
doctrine/annotations                1.14.3 2.0.1  Docblock Annotations Parser
doctrine/doctrine-bundle            2.9.0  2.9.1  Symfony DoctrineBundle
doctrine/doctrine-migrations-bundle 3.2.2  3.2.2  Symfony DoctrineMigrationsBundle
doctrine/migrations                 3.6.0  3.6.0  PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deplo...
doctrine/orm                        2.14.2 2.14.2 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.1.2  2.1.2  PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                     3.4.3  3.4.3  PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies a...
doctrine/dbal                       3.6.1  3.6.2  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations               v1.0.0 v1.0.0 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.0  2.0.0  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.6  2.0.6  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               1.5.0  2.0.0  A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                      2.1.0  3.0.0  PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/persistence                3.1.4  3.1.4  The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter              1.1.3  1.1.3  a PHP SQL highlighting library

PHP version

$ php -v
8.1.16

Subject

Using XML Schema with a timestampable field:

    <field name="createdAt" type="datetime" nullable="true">
      <gedmo:timestampable on="create"/>
    </field>

the following validation error is displayed (eg. on cache:clear): ibxml error: Element '{http://gediminasm.org/schemas/orm/doctrine-extensions-mapping}timestampable': No matching global element declaration available, but demanded by the strict wildcard. in [file] at line 16

doctrine/orm 2.14.1 is working fine.

rufinus avatar Apr 13 '23 13:04 rufinus

  • Related to #2318 and doctrine/DoctrineBundle#1643.
  • Caused by the decision of forbidding the schema extension at doctrine/orm#8852 and the XSD validation implemented at doctrine/orm#10579 and doctrine/DoctrineBundle#1634.
  • Will be temporarily fixed by reverting the XSD validation at doctrine/DoctrineBundle#1644.

BTW, If you can, please update the issue description with the real output from composer show --latest 'doctrine/*' in order to help other users better understand this problem.

phansys avatar Apr 14 '23 05:04 phansys

fix is doctrine.orm.validate_xml_mapping: false, which is deprecated, which is an issue ... but it works :shrug:

ro0NL avatar Aug 14 '23 14:08 ro0NL

This is not a fix. It is a time-limited workaround

stof avatar Aug 23 '23 13:08 stof

true :angel: im not sure what best way forward is. I do like to point out creating addiotional .gedmo.xml (#2657) is not really ideal

in our case, we will probably migrate to attributes sooner or later

ro0NL avatar Aug 23 '23 13:08 ro0NL

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.

github-actions[bot] avatar Feb 19 '24 14:02 github-actions[bot]

Don't stale this issue...

mbabker avatar Feb 26 '24 23:02 mbabker

when it will be fixed?

alebedev80 avatar Jun 11 '24 09:06 alebedev80

Many projects use XML for ORM, and there are no plans to translate this into attributes. In the PR (https://github.com/doctrine-extensions/DoctrineExtensions/pull/2657) I proposed, there are two options for setting up Gedmo:

  1. Use separate XML files for Gedmo ( MyEntity.gedmo.xml )
  2. Use attributes, even if the project uses XML (or annotations) for the ORM.

Without these options, GEDMO takes Doctrine settings, and as a result, it is impossible to use attributes for GEDMO if Doctrine uses xml

eisberg avatar Jun 25 '24 05:06 eisberg