-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug? "Attempted to load class "Unique" from namespace […]MongoDBBundle\Validator\Constraints" #1851
Comments
This issue has already been solved in 1.3.6 and in the dev version of 2.0. Just update your bundle. |
Hey thanks, I schould have updated my composer.json :/ |
I have the same error, with the latest version of 2.0 3efbc08 |
@desarrolla2 are you getting this error in the prod env or in the dev env ? If it is in prod, make sure to clear your cache. |
I have the error in prod, and i cleaned cache, ( and removed complete directory to be sure ) |
I just update to Symfony 2.7 from 2.6 maybe is related to this. @stof I suggest to reopen this ticket |
I downgrade to 2.6 and work ok now. I have no time to investigate in order to give you more information. |
@desarrolla2 Most likely you're missing dependency to doctrine/mongodb-odm-bundle |
@hrba i dont have this dependency, but i didn't using odm otherwise docrine orm, so i think that should not have it. is it correct? |
@desarrolla2 The problem is that right now validation xml is reffering to class which is in bundle you don't have included so it is dependency of FOSUserBundle. Not sure if this approach is right, but to get it working you have to pull those additional deps via composer. You can experience same issue with CouchDBBundle as well, so include doctrine/couchdb-odm-bundle. |
validation.xml does not refer to these classes (at least not in FOSUserBundle, maybe in your own code but then it is your issue). |
I did not mentioned validation.xml but validation xmls, just had a typo. |
Can you open your |
here you go: protected function getValidator_BuilderService()
{
$this->services['validator.builder'] = $instance = \Symfony\Component\Validator\Validation::createValidatorBuilder();
$instance->setConstraintValidatorFactory(new \Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory($this, array('validator.expression' => 'validator.expression', 'Symfony\\Component\\Validator\\Constraints\\EmailValidator' => 'validator.email', 'security.validator.user_password' => 'security.validator.user_password', 'doctrine.orm.validator.unique' => 'doctrine.orm.validator.unique')));
$instance->setTranslator($this->get('translator.default'));
$instance->setTranslationDomain('validators');
$instance->addXmlMappings(array(0 => ($this->targetDirs[3].'/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/config/validation.xml'), 1 => ($this->targetDirs[3].'/vendor/friendsofsymfony/oauth-server-bundle/FOS/OAuthServerBundle/Resources/config/validation.xml'), 2 => ($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation.xml'), 3 => ($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation/mongodb.xml'), 4 => ($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation/orm.xml'), 5 => ($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation/propel.xml'), 6 => ($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation/couchdb.xml')));
$instance->addYamlMappings(array(0 => ($this->targetDirs[3].'/vendor/aboutcoders/file-distribution-bundle/Resources/config/validation.yml')));
$instance->enableAnnotationMapping($this->get('annotation_reader'));
$instance->addMethodMapping('loadValidatorMetadata');
$instance->addObjectInitializers(array(0 => $this->get('doctrine.orm.validator_initializer'), 1 => new \FOS\UserBundle\Validator\Initializer($this->get('fos_user.user_manager'))));
$instance->addXmlMapping(($this->targetDirs[3].'/vendor/friendsofsymfony/user-bundle/FOS/UserBundle/DependencyInjection/Compiler/../../Resources/config/validation/orm.xml'));
return $instance;
} |
There is something really weird. It is adding |
@hrba Which FOSUserBundle version do you use? |
@xabbuh Latest master. |
@hrba do you have any files in |
@stof yes, I have the files in vendor. I'll remove it and see if that works. |
Removing files from the vendor is not solving the issue. |
Well, 2.0.-alpha is before the bug fix. but you are the first one saying you are using the alpha1 release |
I too have this problem. Running Symfony 2.7.1 and FOS User bundle v2.0.0-alpha1 |
@jamhall 2.0-alpha1 is before the bugfix |
So has the bug been fixed on dev-master? (if so, could you give me a link to the commit, thanks!) |
yes. See previous comments |
Thanks. I see the fix was done here: adam187@971658d Could you release a new alpha version with the 2.7 fixes please if possible? I'd rather not use the master branch. Thank you! |
When will a new release be made for 2.0, including this bug fix? Because I don't want to lower my minimum-stability. |
when we overrode some parts of the bundle , we copied the /Resources directly into our bundle and made changes there. even these files were copied: After deleting the above files ( from our bundle ), the issue is solved . Thanks |
It's work for me, my composer :
|
Still getting same error. I've switched to 'dev-master' and it works with Sf 2.7 on dev enviroments, but it triggers the same error on prod enviroment. All vendors cleaned etc, so it won't be corrupted install. Any suggestions? |
I have the same problem after the update ... |
@M4E whihc version of the bundle are you using ? |
Thank, my composer, i'm using Doctrine but same problem :
|
this does not tell me which version is installed. You should use |
Sorry.
|
@M4E same question than in #1851 (comment) |
Sorry @stof but all vendors cleaned etc, so it won't be corrupted install.... |
@stof I identify the problem. All goes well if I do not use |
Damn, I switched to apcu and I wrote my own simillar ApcuClassLoader. - and problem exists |
In my case I solved the issue by just removing whole vendor folder and running composer update again. The issue happened when I migrated from symfony 2.6.8 to symfony 2.8. It's important NOT to keep old files in vendor folder from a previous symfony 2.8 version. For those who use rsync to update from pre to prod, I recommend using --delete option for vendor folder (test if before using -n option for a dry-run test sync) |
Hi, |
Hi, For those who may get this error yet: Check your own user bundle which you made for rewrite and customize fosUserBundle. Too much time and lots of searches and no way to resolve, before checking my own user bundle! Just remove this folder which is not needed in new versions of fos:
Good luck. |
Had the same issue but |
Hi,
I get the following error message, when I use the User class with Doctrine:
See also https://stackoverflow.com/questions/30304551/fosuserbundle-use-mongodb-config-validation-instead-of-orm
As a dirty workaround, I copied the constraint class definitions from the /friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/validation/orm.xml to the mongodb.xml and the couchdb.xml.
Seems as they are both loaded but should not. Is this a bug or a misconfiguration of mine?
The text was updated successfully, but these errors were encountered: