我在ORM-Designer中创建了我的模型,并更改了doctrine配置文件以了解我的应用程序结构,格式如下
-app
-src
-Acme
- Model
- Model_1.php
- Model_2.php
- ...
- ApplicationBundle
- ...
Doctrine config:
# 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
mappings:
model:
type: yml
dir: %kernel.root_dir%/../src/Acme/Model
prefix: Acme\Model
alias: Model
is_bundle: false
Model_1.php例如:
<?php
namespace Acme\Model;
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity
*/
class Model_1
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $attribute_01;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $attribute_02;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $attribute_03;
}
当你看到我的Model
不是一个包时,当我尝试使用doctrine:generate:entities Acme
命令来设置缺少getters
和setters
时,它会抛出以下异常:
[RuntimeExeption] Namespace "Acme" does not contain any mapped entities.
这里有什么问题?