Skip to content
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

PHP Fatal error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found #2224

Closed
dkorsak opened this issue Sep 15, 2016 · 41 comments
Closed

PHP Fatal error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found #2224

dkorsak opened this issue Sep 15, 2016 · 41 comments

Comments

@dkorsak
Copy link

dkorsak commented Sep 15, 2016

After symfony command cache:warmup there is error:

PHP Fatal error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found in ..../vendor/friendsofsymfony/user-bundle/Propel/User.php on line 18
** [out :: 138.201.93.46] [2016-09-15 16:52:02] php.CRITICAL: Fatal Error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found {"exception":"[object](Symfony\Component\Debug\Exception\FatalErrorException%28code: 0%29: Error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found at .../vendor/friendsofsymfony/user-bundle/Propel/User.php:18)"}

Symfony version 3.2.x-dev.

@core23
Copy link

core23 commented Sep 15, 2016

Can you please leave a little more information...

Which bundle versions are you using?

@dkorsak
Copy link
Author

dkorsak commented Sep 15, 2016

dev-master, latest release of FOSUserBundle.
If you will look at file https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Propel/User.php, there is no namespace FOS\UserBundle\Propel\om in the bundle code

@core23
Copy link

core23 commented Sep 15, 2016

@BowlingX
Copy link

that's weird that this file has never been in this bundle (at least till last year). Is there another bundle that provides this file in the same namespace?

@BowlingX
Copy link

The full Propel folder seems to be broken, the whole folder/namespace FOS\UserBundle\Propel\om is not available.

@BowlingX
Copy link

Ok, I think this seems to be an issue with the auto_mapping, this looks familiar: #1646.

The classes in this namespace will be generated if I'm correct?

@BowlingX
Copy link

Looks like a symfony problem to me, after I downgraded to symfony commit #1f9f87b177126fa67739ab109f8f59659f0dab9a (master, 3.2-dev) it's working again. Something broke/changed after this commit

@dkorsak
Copy link
Author

dkorsak commented Sep 24, 2016

Event if I remove propel files from autoloader by adding "exclude-from-classmap" option into composer.json, symfony still is trying to autoload propel files.
Yes, seems to be symfony problem on dev-master branch.

@ryzhov
Copy link

ryzhov commented Sep 27, 2016

Hello, have exactly same issue as BowlingX has, after downgrade to #1f9f87b177126fa67739ab109f8f59659f0dab9a this error "'FOS\UserBundle\Propel\om\BaseUser' not found " not arise

@stof
Copy link
Member

stof commented Sep 27, 2016

The question is what is trying to access these classes. If you don't use Propel, the bundle should never access these classes. And if you use Propel, the base classes will be generated by Propel.

@ryzhov
Copy link

ryzhov commented Sep 27, 2016

I do not use Propel, my FOSUserBundle config is:

fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: UserBundle\Entity\BaseUser
    service:
        mailer: fos_user.mailer.noop

@ryzhov
Copy link

ryzhov commented Sep 27, 2016

friendsofsymfony/user-bundle dev-master 7abb0ff Symfony FOSUserBundle
symfony/symfony dev-master e9e29fa The Symfony PHP framework

cache:clear --env=prod -vvv

 // Clearing the cache for the prod environment with debug false                                                        

 // Warming up cache...                                                                                                 

PHP Fatal error:  Class 'FOS\UserBundle\Propel\om\BaseUser' not found in /var/www/autodial/vendor/friendsofsymfony/user-bundle/Propel/User.php on line 18


  [Symfony\Component\Debug\Exception\ClassNotFoundException]                     
  Attempted to load class "BaseUser" from namespace "FOS\UserBundle\Propel\om".  
  Did you forget a "use" statement for another namespace?                        


Exception trace:
 () at /var/www/autodial/vendor/friendsofsymfony/user-bundle/Propel/User.php:18

@stof
Copy link
Member

stof commented Sep 27, 2016

Please provide the full stack trace, allowing to know what required the Propel user class

@ryzhov
Copy link

ryzhov commented Sep 27, 2016

this is full stack but I not found the source what use this class
out.txt

@cedricziel
Copy link

I just encountered the problem and I think the modifications on the composer autoload definition (specifically the autoload-dev section) is to blame. - Maybe in combination with changes in the class scanning in sf.

Here's the comparison between the current the working and the failing commit: 662463f...FriendsOfSymfony:7abb0ff#diff-b5d0ee8c97c7abd7e3fa29b9a27d1780R54

cedricziel added a commit to cedricziel/FOSUserBundle that referenced this issue Sep 28, 2016
@stof
Copy link
Member

stof commented Sep 28, 2016

what you gave me is an extract of your logs, not the stack trace. Run the cache warmup command in verbose mode to get a stack trace.

Btw, autoload-dev of FOSUserBundle has strictly no impact in your own project (composer will NEVER read this setting for packages installed as a dependency)

@cedricziel
Copy link

That's exactly my thought - still: rolling back just these changes fixes the error.

@ryzhov
Copy link

ryzhov commented Sep 28, 2016

@stof, Did you mean this ?:

bin/console cache:warmup --verbose

 // Warming up the cache for the dev environment with debug true                                                        

PHP Fatal error:  Class 'FOS\UserBundle\Propel\om\BaseUser' not found in /var/www/autodial/vendor/friendsofsymfony/user-bundle/Propel/User.php on line 18
[2016-09-27 09:46:04] php.CRITICAL: Fatal Error: Class 'FOS\UserBundle\Propel\om\BaseUser' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Error: Class 'FOS\\UserBundle\\Propel\\om\\BaseUser' not found at /var/www/autodial/vendor/friendsofsymfony/user-bundle/Propel/User.php:18)"} 


  [Symfony\Component\Debug\Exception\ClassNotFoundException]                     
  Attempted to load class "BaseUser" from namespace "FOS\UserBundle\Propel\om".  
  Did you forget a "use" statement for another namespace?                        


Exception trace:
 () at /var/www/autodial/vendor/friendsofsymfony/user-bundle/Propel/User.php:18

cache:warmup [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

@iskyd
Copy link

iskyd commented Oct 10, 2016

I'm having the same problem.

@cedricziel
Copy link

I've attached a stack-trace.

Looks like the ValidatorCacheWarmer uses the available class-loaders to read metadata from all suitable loaders and that's where the error originates.

I am still convinced that it has something to do with the classmap-especially since the ValidatorBuilder uses it to build its metadata.

The stack trace

$ sf --env=prod cache:clear -vvv

 // Clearing the cache for the prod environment with debug false

 // Clearing outdated warmup directory...

 // Warming up cache...

PHP Fatal error:  Class 'FOS\UserBundle\Propel\om\BaseUser' not found in /home/cziel/projects/my-project/vendor/friendsofsymfony/user-bundle/Propel/User.php on line 18
PHP Stack trace:
PHP   1. {main}() /home/cziel/projects/my-project/bin/console:0
PHP   2. Symfony\Component\Console\Application->run() /home/cziel/projects/my-project/bin/console:29
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
PHP   4. Symfony\Component\Console\Application->doRun() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
PHP   6. Symfony\Component\Console\Command\Command->run() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:846
PHP   7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:257
PHP   8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
PHP   9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:144
PHP  10. Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer->warmUp() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48
PHP  11. Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory->getMetadataFor() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php:71
PHP  12. class_exists() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  13. spl_autoload_call() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  14. Composer\Autoload\ClassLoader->loadClass() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  15. Composer\Autoload\includeFile() /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:301
PHP  16. include() /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:412


  [Symfony\Component\Debug\Exception\ClassNotFoundException]
  Attempted to load class "BaseUser" from namespace "FOS\UserBundle\Propel\om".
  Did you forget a "use" statement for another namespace?


Exception trace:
 () at /home/cziel/projects/my-project/vendor/friendsofsymfony/user-bundle/Propel/User.php:18
PHP Notice:  Undefined index: function in /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php on line 677
PHP Stack trace:
PHP   1. {main}() /home/cziel/projects/my-project/bin/console:0
PHP   2. Symfony\Component\Console\Application->run() /home/cziel/projects/my-project/bin/console:29
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
PHP   4. Symfony\Component\Console\Application->doRun() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
PHP   5. Symfony\Component\Console\Application->doRunCommand() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
PHP   6. Symfony\Component\Console\Command\Command->run() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:846
PHP   7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:257
PHP   8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
PHP   9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:144
PHP  10. Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer->warmUp() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48
PHP  11. Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory->getMetadataFor() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php:71
PHP  12. class_exists() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  13. spl_autoload_call() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  14. Composer\Autoload\ClassLoader->loadClass() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
PHP  15. Composer\Autoload\includeFile() /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:301
PHP  16. include() /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:412
PHP  17. Symfony\Component\Debug\ErrorHandler::handleFatalError() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:0
PHP  18. Symfony\Component\Debug\ErrorHandler->handleException() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:604
PHP  19. call_user_func:{/home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:542}() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:542
PHP  20. Symfony\Component\HttpKernel\EventListener\DebugHandlersListener->Symfony\Component\HttpKernel\EventListener\{closure}() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:542
PHP  21. Symfony\Component\Console\Application->renderException() /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php:113
 () at /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:412
 Composer\Autoload\includeFile() at /home/cziel/projects/my-project/vendor/composer/ClassLoader.php:301
 Composer\Autoload\ClassLoader->loadClass() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
 spl_autoload_call() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
 class_exists() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php:106
 Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory->getMetadataFor() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php:71
 Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer->warmUp() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:144
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:96
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:846
 Symfony\Component\Console\Application->doRunCommand() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/cziel/projects/my-project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:122
 Symfony\Component\Console\Application->run() at /home/cziel/projects/my-project/bin/console:29
 {main}() at /home/cziel/projects/my-project/bin/console:0

@stof
Copy link
Member

stof commented Oct 11, 2016

OK, I think I will move the propel integration into a separate bundle for v2 (and look for a maintainer for it, as I'm not using Propel myself), to avoid such issue.

@tacman
Copy link

tacman commented Oct 11, 2016

How about just gutting Propel? Version 2 will never be finished (it's been
in alpha for years, Version 1 is deprecated. There's no good reason for
using Propel.

Alternatively, you could create the \Propel\om\BaseUser class and check it
into the repo.

On Tue, Oct 11, 2016 at 11:36 AM, Christophe Coevoet <
notifications@github.com> wrote:

OK, I think I will move the propel integration into a separate bundle for
v2 (and look for a maintainer for it, as I'm not using Propel myself), to
avoid such issue.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2224 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAl0QUTMWJIj4TGaGyg9t6QQmoS6acnDks5qy6z9gaJpZM4J-Aqi
.

@OskarStark
Copy link

OskarStark commented Oct 12, 2016

Alternatively, you could create the \Propel\om\BaseUser class and check it
into the repo

This is not how propel should work

@stof
Copy link
Member

stof commented Oct 12, 2016

Alternatively, you could create the \Propel\om\BaseUser class and check it into the repo.

As this class would extend from a Propel class, you would still have the same issue about the missing base class. It would just be the next one.

@stephanvierkant
Copy link

Any update on this? This issue prevents me from updating to Symfony 3.2 right now.

@cedricziel
Copy link

cedricziel commented Nov 1, 2016

@stephanvierkant you can "pin" a healthy commit in the require section in your composer.json.

The last healthy commit is a24e799, so I use this right now and postpone the need to deal with the broken dependency for now:

  "friendsofsymfony/user-bundle": "2.0.x-dev#a24e799c8febbae675d41a42b552574887fa1784",

@ryzhov
Copy link

ryzhov commented Nov 1, 2016

this commit a24e799 does not resolve issue for me

@cedricziel
Copy link

I just double checked it. Works fine for me, but I recall having trouble until i manually removed the cache dir.

@kbsali
Copy link

kbsali commented Nov 2, 2016

same issue here and downgrading to a24e799 won't help either! :(

@tacman
Copy link

tacman commented Nov 2, 2016

Friends don't let friends use Propel.

How about dropping Propel support until Propel2 is at least in beta? For
Propel1 support, use an older version of FOSUserBundle.

If you're upgrading to Symfony 3, you probably should be using an ORM
that's not obsolete or in alpha.

On Wed, Nov 2, 2016 at 11:53 AM, Kevin Saliou notifications@github.com
wrote:

same issue here and downgrading to a24e799
a24e799
won't help either! :(


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2224 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAl0QQj5Od2bPzff7eNYNKLA5L6GtFSiks5q6LINgaJpZM4J-Aqi
.

@core23
Copy link

core23 commented Nov 2, 2016

👍 for dropping propel. We can (re)add support later, if someone needs this.

@codereviewvideos
Copy link

I've done a little further digging into this, and have a temporary workaround, but not a solution.

vendor/friendsofsymfony/user-bundle/Resources/config/validation.xml

https://github.com/FriendsOfSymfony/FOSUserBundle/blob/v2.0.0-alpha3/Resources/config/validation.xml#L97

comment out lines 97 > 183

Cache should now clear.

The issue appears to have been triggered by the inclusion of the ValidatorCacheWarmer in Symfony 3.2.

My theory goes that extracting the propel part of the validation.xml file to e.g. validation_propel.xml, and selectively loading that if using propel would solve the problem. Unfortunately, my current attempt to fix this problem is hitting this issue - something to do with the way I'm loading the config, but not sure exactly what yet:

 [InvalidArgumentException]                                                                                        
  [ERROR 1845] Element '{http://symfony.com/schema/dic/constraint-mapping}constraint-mapping': No matching global   
  declaration available for the validation root. (in /var/www/api.tribecount.dev/ - line 5, column 0)     

fabpot added a commit to symfony/symfony that referenced this issue Nov 22, 2016
… non-existent class (Seldaek)

This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #20559).

Discussion
----------

[FrameworkBundle] Avoid warming up the validator cache for non-existent class

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? |no
| Tests pass?   | yes
| License       | MIT

This relates to FriendsOfSymfony/FOSUserBundle#2224 - where basically the cache warmer triggers autoloading of a class that is broken, and it then blows up.

This doesn't fix the problem in itself, loading broken classes will still fail, but it allows us at least to work around it by doing:

```
        "exclude-from-classmap": [
            "vendor/friendsofsymfony/user-bundle/Propel/"
        ]
```

And then `composer dump-autoload -a` to get an authoritative classmap. That way the hasMetadataFor will return false because class_exist() won't try to load the class at all. Without the hasMetadataFor fix though, it calls getMetadataFor which throws an exception in the case the class doesn't exist. I am not sure if that's by design.. that the cache warmer would force you to have classes existing for all your validation definitions.

Commits
-------

cb12f22 [FrameworkBundle] Avoid warming up the validator cache for non-existent classes
@XWB
Copy link
Member

XWB commented Nov 22, 2016

Can you guys try the latest Symfony 3.2 branch? symfony/symfony@59f9949

@ryzhov
Copy link

ryzhov commented Nov 22, 2016

I have same issue on symfony/symfony@a4edafbd

@codereviewvideos
Copy link

@XWB - just checked #59f9949 of Symfony, and #4ea37a5 of FOSUserBundle, and the cache clears fine for me 👍

@XWB
Copy link
Member

XWB commented Nov 22, 2016

@ryzhov You need to use the 3.2 branch, Symfony master branch has not been updated yet.

@ryzhov
Copy link

ryzhov commented Nov 22, 2016

still not work in this environment

symfony/symfony 3.2.x-dev 59f9949 The Symfony PHP framework
friendsofsymfony/user-bundle dev-master dd966ca Symfony FOSUserBundle

@dkorsak
Copy link
Author

dkorsak commented Nov 22, 2016

Does not work.
After add to te composer.json

        "exclude-from-classmap": [
            "vendor/friendsofsymfony/user-bundle/Propel/"
        ]

composer still creating autoload class map with Propel files (composer bug?)
Event if I remove manually Propel files from composer autload class, still does not work.

Composer\Autoload\ClassLoader->loadClass function if will not find class in the class map, will find
file friendsofsymfony/user-bundle/Propel/User.php by path.

ValidatorCacheWarmer class (XmlFileLoader) is trying to load Propel classes because in the file

/friendsofsymfony/user-bundle/Resources/config/validation.xml 

there is

<class name="FOS\UserBundle\Propel\User">

and Symfony parsing this file is trying to load class FOS\UserBundle\Propel\User.

The solution is to split file

/friendsofsymfony/user-bundle/Resources/config/validation.xml 

into Doctrine and Propel validation_{orm}.xml files and load files manually by compiler pass:

see for example
http://stackoverflow.com/questions/24064813/how-to-split-validation-yaml-files-in-symfony-2-5/24210501#24210501

Exactly to fix it you can update file https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/DependencyInjection/Compiler/ValidationPass.php

by add something like

$validationFile = __DIR__.'/../../Resources/config/validation/orm.xml';
 if ($storage == 'propel') {
     $validationFile = __DIR__ . '/../../Resources/config/validation/propel.xml';
 }
 $container->getDefinition('validator.builder')
      ->addMethodCall('addXmlMapping', array($validationFile));

and split /friendsofsymfony/user-bundle/Resources/config/validation.xml into orm.xml and propel.xml
and update documentaion

@stof
Copy link
Member

stof commented Nov 22, 2016

@dkorsak not a composer bug. As these files are in the FOSUserBundle package, the exclude rule would have to be added in the FOSUserBundle metadata

@XWB
Copy link
Member

XWB commented Nov 22, 2016

Propel support has been removed.

#2309

@ryzhov
Copy link

ryzhov commented Nov 22, 2016

now cache:clear works as expected, thanks !

@XWB XWB closed this as completed Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.