English 中文(简体)
2 ORM和MongoDB ODM
原标题:Doctrine 2 ORM and MongoDB ODM mapping on the same class

是否有可能利用说明将同一类别绘制给管理办公室和管理部?

我们正在决定什么用途,这样我们就想做一些实绩保证,我们也希望能够轻易改变援助地图。 我已经做了管理人员的统一工作,现在我要统一这些班子。 现在,我有每个类别的印本,分别以实体名称和文件名称,即发现多余。

我读到这一条:,但在终端iguess中,他们使用两种不同的课程,每个课程都有自己的空间。

没有人试图这样做?

问题回答

我从未尝试过,但完全有可能把OMD和ORM地图放在同一个类别上。

The problem will maybe rely on synchronization of data between these two persistence backends and the Entity API. For example, if you have a ManyToOne association, ODM will have a different internal in memory reference than ORM. So it s possible that it will override objects you were working with.

此前是否试图这样做,但如果我能建议,对贵实体/文件类别进行Xml/yml的不同测绘?

是的。 我这样做时使用了国名和说明,因此,我猜测你既能管理,又能利用你使用的任何环境。

第一,我增加了两个关于实体的说明:

<?php
use DoctrineORMMapping as ORM;
use DoctrineODMMongoDBMappingAnnotations as ODM;

/**
 * User
 *
 * @ORMEntity
 * @ODMDocument
 */
class User
{
    /**
     * @var integer
     *
     * @ORMColumn(name="id", type="integer", nullable=false)
     * @ORMId
     * @ODMField()
     */
    private $id;

    /**
     * @var string
     *
     * @ORMColumn(name="email", type="string", length=200, nullable=false)
     * @ODMField()
     */
    private $email;
}

根据公证,公投管处的违约名录是实体名录,因为公投管处的违约名录是文件。 因此,如果你有一个实体必须同时成为文件,那么你必须手工整理两个地图。

doctrine_mongodb:
    document_managers:
        default:
            mappings:
                # Default mapping for the bundle (loads Document/)
                DemoBundle: ~
                # Extra mapping to load document mappings under Entity/
                DualMappingHack:
                    type: annotation
                    dir: %kernel.root_dir%/../src/Acme/DemoBundle/Entity
                    prefix: EntityPrefix
                    is_bundle: false




相关问题
Entity Framework with File-Based Database

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I m not crazy about having ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签