IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Symfony PHP Discussion :

The annotation does not exist [2.x]


Sujet :

Symfony PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 17
    Par défaut The annotation does not exist
    bonjour,

    j'essai de faire le tuto pour débutant : http://j-place.developpez.com/tutori...avec-symfony2/

    Mais lorsque je fais la commande :

    php app/console doctrine:generate:entities MyApp
    j'ai le message d'erreur suivant:
    [Doctrine\Common\Annotations\AnnotationException]
    [Semantical Error] The annotation "@Doctrine\ORM\Mapping\nom" in property MyApp\FilmothequeBundle\Entity\Acteur::$nom does not exist, or could not be auto-loaded.
    Et je ne sais pas ou chercher.

    Est-ce que vous avez une idée?

    D'avance merci.

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2013
    Messages
    60
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2013
    Messages : 60
    Par défaut
    Bonjour,

    Il semblerait que l'annotationRegistry ne soit pas chargé. A quoi ressemble ton fichier app/autoload.php ?

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 17
    Par défaut
    voila mon autoload:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <?php
     
    use Doctrine\Common\Annotations\AnnotationRegistry;
    use Composer\Autoload\ClassLoader;
     
    /**
     * @var $loader ClassLoader
     */
    $loader = require __DIR__.'/../vendor/autoload.php';
     
    AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
     
    return $loader;
    C'est celui par default, j'ai rien modifié.

  4. #4
    Membre émérite
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Août 2011
    Messages
    477
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France

    Informations professionnelles :
    Activité : Technicien maintenance
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Août 2011
    Messages : 477
    Par défaut
    bonsoir ou bonjour,

    ce tuto date un peu et tu seras vite coincé. car il est écris pour la version 2.0. toutefois pour ton erreur regarde bien comment tu as écris tes annotations dans ton entité Acteur il y a une erreur à la propriété indiqué nom. Sinon tu ne l as trouve pas post le code de l entité acteur.

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 17
    Par défaut
    bonsoir,

    voila mon fichier acteur.php

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <?php
    Namespace MyApp\FilmothequeBundle\Entity;
    use Doctrine\ORM\Mapping as ORM;
    use Symfony\Component\Validator\Constraints as Assert;
     
    /**
     * @ORM\Entity
     */
    class Acteur
    {
        /**
         * @ORM\Column(type="integer")
         * @ORM\GeneratedValue
         * @ORM\id
         */
        private $id;
     
        /**
         * @ORM\Column(type="string",length=255)
         * @Assert\NotBlank()
         * @Assert\MinLength(3)
         */    
        private $nom;
     
        /**
         * @ORM\Column(type="string",length=255)
         * @Assert\NotBlank()
         * @Assert\MinLength(3)
         */    
        private $prenom;
     
        /**
         * @ORM\Column(type="date")
         * @Assert\NotBlank()
         */    
        private $dateNaissance;
     
        /**
         * @ORM\Column(type="string",length=1)
         * @Assert\NotBlank()
         * @Assert\Choice(choices = {"M", "F"})
         */    
        private $genre;
    }
    Je suis avec la version 2.23, je pense que ce tuto est toujours d'actualité.

  6. #6
    Membre émérite
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Août 2011
    Messages
    477
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France

    Informations professionnelles :
    Activité : Technicien maintenance
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Août 2011
    Messages : 477
    Par défaut
    c louche effectivement.

    je dirai suppression du cache à la main un PHP composer update

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 17
    Par défaut
    donc j'ai supprimé le cache, mais j'ai toujours la même erreur. Alors j'ai simplement supprimer la ligne :

    @ Assert\Minlenght
    et miracle ça marche !!

    Je continu le tuto, mais il bloque sur la création du schema
    C:\wamp\www\Symfony2>php app/console doctrine:schema:create
    ATTENTION: This operation should not be executed in a production environment.

    Creating database schema...
    PHP Fatal error: Call to a member function setTimezone() on a non-object in C:\wamp\www\Symfony2\vendor\monolog\monolog\src\Monolog\Logger.php on line 208
    Encore un message d'erreur prise de tête !!! HELP.

  8. #8
    Membre émérite
    Homme Profil pro
    Technicien maintenance
    Inscrit en
    Août 2011
    Messages
    477
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France

    Informations professionnelles :
    Activité : Technicien maintenance
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Août 2011
    Messages : 477
    Par défaut
    L'@ssert Minlength en 2.2 a changé (quand je te dis que ce tuto est pour la version 2.0)

    @ssert Length

    Pour le settimezone, as tu effectué la commande, php app/check.php ?

    Il faut que tes fichiers php.ini pour le cli et apache soit modifié.

  9. #9
    Membre averti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 17
    Par défaut
    bonjour,

    j'ai fait un premier test pour le assert\lenght, mais j'ai la même erreur. J'ai simplement ajouté @assert ..., puis relancer la commande :
    php app/console doctrine:generate:entities MyApp
    Est-ce que c'est la procédure? ou est-ce qu'il faut refaire un fichier acteur.php vide?(sans les get, set, ...)

    Pour ce qui de php, c'est la version 5.4.17 qui est détectée par apache (2.2.11), mais voici le résultat du php info:

    ********************************
    * *
    * Symfony requirements check *
    * *
    ********************************

    * Configuration file used by PHP: C:\wamp\bin\php\php5.3.0\php.ini

    ** ATTENTION **
    * The PHP CLI can use a different php.ini file
    * than the one used with your web server.
    * (especially on the Windows platform)
    * To be on the safe side, please also launch the requirements check
    * from your web server using the web/config.php script.

    ** Mandatory requirements **

    ERROR PHP version must be at least 5.3.3 (5.3.0 installed)
    Install PHP 5.3.3 or newer (installed version is 5.3.0)

    OK PHP version must not be 5.3.16 as Symfony won't work properly with it
    OK Vendor libraries must be installed
    OK app/cache/ directory must be writable
    OK app/logs/ directory must be writable
    OK date.timezone setting must be set
    OK json_encode() must be available
    OK session_start() must be available
    OK ctype_alpha() must be available
    OK token_get_all() must be available
    OK simplexml_import_dom() must be available
    OK detect_unicode must be disabled in php.ini
    OK PCRE extension must be available

    ** Optional recommendations **

    OK Requirements file should be up-to-date
    WARNING You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions
    Your project might malfunction randomly due to PHP bug #52083 ("Notice : Trying to get property of non-object"). Install PHP 5.3.4 or newer.

    WARNING When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156
    Install PHP 5.3.8 or newer if your project uses annotations.

    OK You should not use PHP 5.4.0 due to the PHP bug #61453 WARNING PCRE extension should be at least version 8.0 (7.9 installed)
    PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an out dated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.

    OK PHP-XML module should be installed
    OK mb_strlen() should be available
    OK iconv() should be available
    OK utf8_decode() should be available WARNING intl extension should be available
    Install and enable the intl extension (used for validators).

    WARNING a PHP accelerator should be installed
    Install and enable a PHP accelerator like APC (highly recommended).

    OK short_open_tag should be disabled in php.ini
    OK magic_quotes_gpc should be disabled in php.ini
    OK register_globals should be disabled in php.ini
    OK session.auto_start should be disabled in php.ini
    OK PDO should be installed
    OK PDO should have some drivers installed (currently available: mysql, sqlite)
    Est-ce que je dois faire des modifs?

    Merci pour ton aide !!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [1.x] The component does not exist: "sfGuardAuth", "signin".
    Par khand dans le forum Symfony
    Réponses: 23
    Dernier message: 26/07/2011, 08h24
  2. [1.x] The component does not exist
    Par akito dans le forum Symfony
    Réponses: 2
    Dernier message: 28/06/2011, 15h37
  3. [c3p0] The connection does not exist
    Par vince29 dans le forum Hibernate
    Réponses: 3
    Dernier message: 28/01/2009, 13h30
  4. Problème "The specified service does not exist as an ..
    Par Rimak2 dans le forum MS SQL Server
    Réponses: 4
    Dernier message: 23/05/2005, 22h24
  5. FATAL 1: Database "x" does not exist in the syste
    Par barbituric dans le forum PostgreSQL
    Réponses: 11
    Dernier message: 17/03/2004, 07h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo