Closed AntonioCS closed 6 years ago
Hi,
for the 2.2 version of the this bundle, the dependency is requires. In the current master, the ApiBundle is removed (https://github.com/sonata-project/SonataUserBundle/pull/650).
Thanks. I will change to dev-master in the composer.json.
Be aware of using the master version, because you are using a bleeding edge version. This should not be used for a production environment.
Right. Any version that I can use that does not have this bundle issue?
I see there was a new release. You could use version 2.2.4.
Changed to 2.2.4, did composer update and got this:
PHP Fatal error: Declaration of Sonata\UserBundle\Block\AccountBlockService::validateBlock() must be compatible with Sonata\BlockBundle\Block\BlockAdminServiceInterface::validateBlock(Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\BlockBundle\Model\BlockInterface $block) in /var/www/mylocalpitch/rc_mlp_20140609/vendor/sonata-project/user-bundle/Block/AccountBlockService.php on line 110
Can you show your composer config? @AntonioCS
I am experiencing the same problem, but I don't think it's SonataUserBundle's fault in my case. I am using the master branch, the api controllers do not get loaded by SonataUserBundle, which is correct, but for some reason JMSDiExtraBundle loads the controllers anyway (or at least they are not loaded if I disable JMSDiExtraBundle) and therefore it comes to the same exception as OP's initial one.
Something is fucked up since i explicitly configured
jms_di_extra:
locations:
all_bundles: false
I guess this is the point when magic starts kicking your butt :-/
I have the same problem: using JMSDiExtraBundle without NelmioApiDocBundle.
Maybe the problem relies in the cache warmer scanning all bundles folders and looking for controllers (note that all_bundles: false
is ignored).
It works if you disable the warmer:
jms_di_extra:
cache_warmer:
enabled: false
There is a blacklist option but it relies on the controller realpath.
What about prepending the blacklist option if JMSDiExtraBundle is found but NelmioApiDocBundle not?
Edit: I made a quick test with the following prepended configuration and it seems to work just fine (other sonata bundles have the same issue, like SonataClassificationBundle). I can work on a PR.
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (isset($bundles['JMSDiExtraBundle']) &&
(!isset($bundles['NelmioApiDocBundle']) || !isset($bundles['FOSRestBundle']))) {
$blacklistedControllers = [];
foreach (glob(__DIR__.'/../Controller/Api/*.php', GLOB_NOSORT) as $filename) {
$blacklistedControllers[] = realpath($filename);
}
if (!empty($blacklistedControllers)) {
$container->prependExtensionConfig('jms_di_extra', [
'cache_warmer' => [
'controller_file_blacklist' => $blacklistedControllers,
],
]);
}
}
}
I can work on a PR.
Amazing work. Please do!
@gremo Nice workaround. But I guess it would be preferrable if this would be fixed in JmsDiExtraBundle itself, so that all_bundles: false
is working correctly. Maybe better put your effort into an PR over at https://github.com/schmittjoh/JMSDiExtraBundle ? Anyway, looking forward to a solution :)
@kaiwa I agree, but a PR (shouldn't hard to write) on JMSDiExtraBundle could take months to be accepted. In addition we have BC to older version of JMSDiExtraBundle.
Did someone report the bug to JMSDiExtraBundle
?
In addition we have BC to older version of JMSDiExtraBundle.
I think we can drop older versions if it's not a major version we're dropping.
@greg0ire
Did someone report the bug to JMSDiExtraBundle ?
Yes I did, here you go:
I just opened a new one https://github.com/schmittjoh/JMSDiExtraBundle/issues/269 and I'm sending a PR.
This seems to be solved, or atleast belongs to JMSDiExtraBundle. If I am wrong ping me and I will reopen
Hey,
I have
"sonata-project/user-bundle": "^2.2"
in my composer.json. I do not plan to use any type of API component. When I docomposer update
I get this:Do I need to install & configure FOSRestBundle and NelmioApiDocBundle? Is this something that you are forcing users to do???