Doctrine 2 - 从数据库生成带有视图的实体 [英] Doctrine 2 - Generate entities with views from database

查看:20
本文介绍了Doctrine 2 - 从数据库生成带有视图的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 Doctrine 2 从数据库生成视图?

Is it possible to generate a view from database with Doctrine 2?

我解释一下:

我的数据库包含一些我想使用的视图,但我不知道如何生成这些视图.

My db contains some views I want use, but I don't know how generate these views.

在我的例子中,我有两个表和一个视图,视图在每个表中选择了几列,我只想在项目的实体"文件夹中找到这个视图.

In my case, I have two tables and one view, the view selects a few columns in each table and I just want THIS view in the folder "Entity" of the project.

推荐答案

Doctrine 2 目前支持数据库视图,但它的性能可能很差.自己尝试将视图映射为实体并将其标记为@readOnly 实体.

Database views are not currently supported by Doctrine 2, but it can potentially perform very badly. Try it yourself mapping the view as an entity and mark it as a @readOnly entity.

这篇关于Doctrine 2 - 从数据库生成带有视图的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆