Symfony FOSUserBundle versions: 2.0.1
PHP version: 7.1.9
Api platform version: 2.1.0
Description of the problem including expected versus actual behavior:
I am trying to use api-platform with fosuserbundle. I use the docker version 2.1.0 of api-platform, I installed with composer the version 2.0.1 of fosuserbundle. After adding the required configuration in YAML, I have the following error :
The service "fos_user.profile.form.factory" has a dependency on a non-existent service "form.factory".
I tried many times but always the same error...
Steps to reproduce:
docker-compose exec app composer require friendsofsymfony/user-bundle "~2.0"
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
<?php
// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
* @ApiResource(attributes={
* "normalization_context"={"groups"={"user", "user-read"}},
* "denormalization_context"={"groups"={"user", "user-write"}}
* })
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Groups({"user"})
*/
protected $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"user"})
*/
protected $fullname;
/**
* @Groups({"user-write"})
*/
protected $plainPassword;
/**
* @Groups({"user"})
*/
protected $username;
public function setFullname($fullname)
{
$this->fullname = $fullname;
return $this;
}
public function getFullname()
{
return $this->fullname;
}
public function isUser(UserInterface $user = null)
{
return $user instanceof self && $user->id === $this->id;
}
}
Provide logs (if relevant):
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "fos_user.profile.form.factory" has a dependency on a non-existent service "form.factory".
Exception trace:
() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:31
Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php:57
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:35
Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php:64
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:35
Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php:57
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:35
Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php:36
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:143
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:746
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:577
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:119
Symfony\Component\HttpKernel\Kernel->boot() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:69
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /srv/api-platform/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:125
Symfony\Component\Console\Application->run() at /srv/api-platform/bin/console:27
Thanks
Closed the issue with the help of one member.
It was missing this configuration line :
form: { enabled: true }
Doesn't make sense to not add it by default seriously or have a proper documentation for this.
Thanks...
thanks ! ;)
@ntdetect you have to put it in app/config/config.yml
framework:
form: { enabled: true }
thank youu soo mutch @antoinemineau it's my bad , i forgot a "form: { enabled: false}" in the begin of the code.
Most helpful comment
Closed the issue with the help of one member.
It was missing this configuration line :
Doesn't make sense to not add it by default seriously or have a proper documentation for this.