问题描述
配置使用:
doctrine:
dbal:
driver: "%database_driver%"
....
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
auto_mapping
的确切含义是什么?它被用于真实和虚假的吨数,没有精确的描述。
发生代理生成(如果不是自动)?通过doctrine命令行工具?
What is the exact meaning of auto_mapping
? It is used in tons of exemples with true and false, and no precise description.When does occurs the proxy generation if it's not auto ? By doctrine command-line tools ?
推荐答案
auto_mapping
自动从您的包 Resources / config / doctrine
目录中加载映射。
auto_mapping
is where doctrine will automatically load the mapping from your bundle Resources/config/doctrine
directory.
将其设置为false将意味着您将需要自己加载映射。如果您有实体的映射,而不是要覆盖的供应商捆绑包中的映射超类,那么它可以很方便。
Setting it to false will mean that you will need to load the mappings yourself. It can be handy if you have mappings for entities rather than mapped superclasses in a vendor bundle that you want to override.
您可以通过说明映射在教条配置...
You can do this either by way of stating the mappings in the doctrine config ...
doctrine:
orm:
entity_managers:
default:
mappings:
AcmeUnknownBundle:
mapping: true
type: yml
dir: "Resources/config/doctrine"
alias: ~
prefix: Acme\UnknownBundle\Entity
is_bundle: true
将它们添加到一些一种 ...
adding them in some sort of mappings pass ...
class AcmeUnknownBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
// ...
$modelDir = realpath(__DIR__.'/Resources/config/doctrine/model');
$mappings = array(
$modelDir => 'Acme\UnknownBundle\Model',
);
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
if (class_exists($ormCompilerClass)) {
$container->addCompilerPass(
DoctrineOrmMappingsPass::createYamlMappingDriver(
$mappings,
array('acme_unknown.model_manager_name'),
true
));
}
}
}
这篇关于Symfony:auto_mapping和auto_generate_proxy_classes的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!