问答详情
源自:9-3 生成get-set-repository

symfony2.6 - 无法生成get-set-repository

<?php

namespace Abrasumente\WebBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM|Entity(repositoryClass="UserRepository")
 * @ORM|Table(name="user")
 */
class user {

    /**
     * @ORM|Id
     * @ORM|Column(type="integer")
     * @ORM|GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM|Column(type="string")
     */
    protected $username;

    /**
     * @ORM|Column(type="string")
     */
    protected $password;

}


执行 

app/console generate:doctrine:entities AbrasumenteWebBundle

Generating entities for bundle "AbrasumenteWebBundle"


                                                                               
  [Doctrine\Common\Annotations\AnnotationException]                            
  [Semantical Error] The annotation "@Doctrine\ORM\Mapping" in class Abrasume  
  nte\WebBundle\Entity\user does not exist, or could not be auto-loaded.       
                                                                               


doctrine:generate:entities [--path="..."] [--no-backup] name


提问者:11111 2015-02-13 21:08

个回答

  • 11111
    2015-02-23 10:32:34

    <script>console.log('well!')</script>

  • 11111
    2015-02-23 10:31:08

    <test>

  • 11111
    2015-02-13 21:34:46

    检查了一下.....发现把斜杠写成竖线了, 神坑.

    <?php
    
    namespace Abrasumente\WebBundle\Entity;
    
    use Doctrine\ORM\Mapping as ORM;
    
    /**
     * @ORM\Table(name="users")
     * @ORM\Entity()
     */
    class User {
    
        /**
         * @ORM\Id
         * @ORM\Column(type="integer")
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        protected $id;
    
        /**
         * @ORM\Column(type="string")
         */
        protected $username;
    
        /**
         * @ORM\Column(type="string")
         */
        protected $password;
        
        }