bonsoir à tous s'il vous plait jai des difficultés avec l'installation de Fosuser Bundle
Salut,
Qu'est ce qui te donne des difficulté exactement ?
l'inscallaiton ? le paramètrage ?
salut,
Le paramettrage j'ai vraiment suivit à la lettre le tuto et j'ai l'erreur suivante:
Whoops, looks like something went wrong.
1/1
InvalidConfigurationException in VariableNode.php line 88:
The path "fos_user.from_email.address" cannot contain an empty value, but got null.
in VariableNode.php line 88
at VariableNode->finalizeValue(null) in BaseNode.php line 303
at BaseNode->finalize(null) in ArrayNode.php line 254
at ArrayNode->finalizeValue(array('address' => null, 'sender_name' => null)) in BaseNode.php line 303
at BaseNode->finalize(array('address' => null, 'sender_name' => null)) in ArrayNode.php line 254
at ArrayNode->finalizeValue(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AppBundle\Entity\User', 'from_email' => array('address' => null, 'sender_name' => null))) in BaseNode.php line 303
at BaseNode->finalize(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AppBundle\Entity\User', 'from_email' => array('address' => null, 'sender_name' => null))) in Processor.php line 37
at Processor->process(object(ArrayNode), array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AppBundle\Entity\User', 'from_email' => array('address' => null, 'sender_name' => null)))) in Processor.php line 50
at Processor->processConfiguration(object(Configuration), array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AppBundle\Entity\User', 'from_email' => array('address' => null, 'sender_name' => null)))) in FOSUserExtension.php line 51
at FOSUserExtension->load(array(array('db_driver' => 'orm', 'firewall_name' => 'main', 'user_class' => 'AppBundle\Entity\User', 'from_email' => array('address' => null, 'sender_name' => null))), object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 59
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 104
at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 598
at ContainerBuilder->compile() in bootstrap.php.cache line 2754
at Kernel->initializeContainer() in bootstrap.php.cache line 2529
at Kernel->boot() in bootstrap.php.cache line 2560
at Kernel->handle(object(Request)) in app_dev.php line 28
voila mes fichier:
le karnel
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Ecommerce\EcommerceBundle\EcommerceBundle(),
new Pages\PagesBundle\PagesBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Utilisateurs\UtilisateurBundle\UtilisateurBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
Le config:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
#translator: { fallback: "%locale%" }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
le fichier security
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
et le fichier utilisateur
<?php
namespace Utilisateurs\UtilisateurBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use FOS\UserBundle\Entity\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="Utilisateur")
*/
class Utilisateurs extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
OK,
Ton erreur est "The path "fos_user.from_email.address" cannot contain an empty value, but got null."
va dans ton fichier "app/config/parameters.yml" puis remplis les informations demandé:
mailer_transport
mailer_host
mailer_user
mailer_password
merci déja de m'accompagner, mais s'il vous plait qu'est ce que je peu mettre comme valeurs pour les information
transport: smtp
host: 127.0.0.1 (mettre le host de ton serveur mail plutard mais pour le moment ça suffiras)
user: ton adresse mail
password: mdp de ton adresse mail
cool merci je n'ai plus d'erreur mais suelement je n'arrive pas à mettre à jour la base de donné
![]()
mon erreur console est la suivante:
Fatal Error : Namespace declaration statement has to be the verify first statement in the script in "c:\wamp\www\ecommerce\src\utilisateur\utilisateurBundle\Entity\utilisateurs.php on line 2 "
et voila mon fichier utilisateur
<?php
namespace Utilisateurs\UtilisateurBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="Utilisateur")
*/
class Utilisateurs extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
Salut
Tu as pas un "s" en trop dans ton premier "Utilisateurs" de ton namespace => namespace Utilisateur\UtilisateurBundle\Entity;
De plus ,fais attention à la casse dans tes noms de dossier, sur Windows ça va fonctionner mais pas sur un Linux. Et aussi, Les entités sont normalement au singulier.
oui tu a le "s" du premier "utilisateur" et j'ai aussi l'impression que tes dossiers "utilisateur" et "utilisateurBundle" on la première lettre en minuscule et non en majuscule.