sonata-project / SonataUserBundle

Symfony SonataUserBundle
https://docs.sonata-project.org/projects/SonataUserBundle
MIT License
339 stars 488 forks source link

BaseGroup.mongodb.xml is invalid #1120

Closed helacer3 closed 4 years ago

helacer3 commented 4 years ago

I have a symfony 4.3.5 application with sonata admin. A few days ago I had to perform the dependency update and this error is appearing in the package. I try, installing different versions but they all found me this error, which I didn't find documentation for their solution

Resources/config/doctrine/BaseGroup.mongodb.xml is invalid: Line 2:0: Element '{http://doctrine-project.org/schemas/orm/doctrine-mapping}doctrine-mapping': No matching global declaration available for the validation root.

COMPOSER.JSON

    "sonata-project/core-bundle": "^3.12.0",
    "sonata-project/user-bundle": "^4.2.0",

Can you help me verify what is happening? Thank you!

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

javer commented 4 years ago

Yes, bug is still relevant, to fix it the following changes

s/doctrine-mapping/doctrine-mongo-mapping/
s/orm/odm/

should be applied to the following files:

But it will break backward compatibility with doctrine/mongodb-odm 1.x, so major version should be bumped.

core23 commented 4 years ago

But it will break backward compatibility with doctrine/mongodb-odm 1.x, so major version should be bumped.

This is not a BC break as long us you update the composer definition for this lib. Can you provide a PR @javer

javer commented 4 years ago

@core23 It seems that this issue is already fixed in #1140, but it's not released yet. Could you please make a new release with all recent fixes?

core23 commented 4 years ago

@sonata-project/release-managers Can you please tag a new release

jordisala1991 commented 4 years ago

Closing as this was released already in 4.5.2

webdevilopers commented 3 years ago

I still have the issue with the following packages:

    "require": {
        "php": "^7.4",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "friendsofsymfony/user-bundle": "^2.1",
        "sonata-project/admin-bundle": "^3.93",
        "sonata-project/doctrine-mongodb-admin-bundle": "^3.7",
        "sonata-project/exporter": "2.x",
        "sonata-project/intl-bundle": "^2.10",
        "sonata-project/translation-bundle": "^2.7",
        "sonata-project/user-bundle": "^4.11",
        "symfony/apache-pack": "^1.0",
        "symfony/dotenv": "^4.4",
        "symfony/flex": "^1.12",
        "symfony/framework-bundle": "^4.4",
        "symfony/http-kernel": "^4.4",
        "symfony/yaml": "^4.4",
        "twig/twig": "^2.9"
    },

Refs:

webdevilopers commented 3 years ago

Let me correct this. The mapping for this bundle has indeed been fixed:

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping                         http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd">
    <mapped-superclass name="Sonata\UserBundle\Document\BaseUser">
        <field name="createdAt" type="date"/>
        <field name="updatedAt" type="date"/>
        <!-- Profile fields -->
        <field name="dateOfBirth" type="date"/>
        <field name="firstname" type="string"/>
        <field name="lastname" type="string"/>
        <field name="website" type="string"/>
        <field name="biography" type="string"/>
        <field name="gender" type="string"/>
        <field name="locale" type="string"/>
        <field name="timezone" type="string"/>
        <field name="phone" type="string"/>
        <!-- social fields -->
        <field name="facebookUid" type="string"/>
        <field name="facebookName" type="string"/>
        <field name="facebookData" type="hash"/>
        <field name="twitterUid" type="string"/>
        <field name="twitterName" type="string"/>
        <field name="twitterData" type="hash"/>
        <field name="gplusUid" type="string"/>
        <field name="gplusName" type="string"/>
        <field name="gplusData" type="hash"/>
        <!-- extra security fields -->
        <field name="token" type="string"/>
        <field name="twoStepVerificationCode" type="string"/>
        <lifecycle-callbacks>
            <lifecycle-callback type="prePersist" method="prePersist"/>
            <lifecycle-callback type="preUpdate" method="preUpdate"/>
        </lifecycle-callbacks>
    </mapped-superclass>
</doctrine-mongo-mapping>

But with the packages mentioned above I the the error for the FosUserBundle itself:

  The mapping file //vendor/friendsofsymfony/user-bundl  
  e/Resources/config/doctrine-mapping/Group.mongodb.xml is invalid:            
  Line 9:0: Element '{http://doctrine-project.org/schemas/odm/doctrine-mongo-  
  mapping}field', attribute 'fieldName': The attribute 'fieldName' is not all  
  owed.                                                                        

  Line 11:0: Element '{http://doctrine-project.org/schemas/odm/doctrine-mongo  
  -mapping}field', attribute 'fieldName': The attribute 'fieldName' is not al  
  lowed.                                                                       
webdevilopers commented 3 years ago

I linked the following issue there: https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2948 Maybe this is just a matter of package versions?