29. Limitations and Known Issues

We try to make using Doctrine2 a very pleasant experience. Therefore we think it is very important to be honest about the current limitations to our users. Much like every other piece of software Doctrine2 is not perfect and far from feature complete. This section should give you an overview of current limitations of Doctrine ORM as well as critical known issues that you should know about.

私たちは Doctrine2 の使用を非常に快適なものにするよう努めています。そのため、ユーザーに対する現在の制限について正直に話すことが非常に重要であると考えています。他のすべてのソフトウェアと同じように、Doctrine2 は完璧ではなく、完全な機能には程遠いものです。このセクションでは、Doctrine ORM の現在の制限と、知っておくべき重大な既知の問題の概要を説明します。

29.1. Current Limitations

There is a set of limitations that exist currently which might be solved in the future. Any of this limitations now stated has at least one ticket in the Tracker and is discussed for future releases.

現在存在する一連の制限があり、将来的には解決される可能性があります。現在述べられているこの制限のいずれも、トラッカーに少なくとも 1 つのチケットがあり、将来のリリースで検討されています。

29.1.1. Join-Columns with non-primary keys

It is not possible to use join columns pointing to non-primary keys. Doctrine will think these are the primary keys and create lazy-loading proxies with the data, which can lead to unexpected results. Doctrine can for performance reasons not validate the correctness of this settings at runtime but only through the Validate Schema command.

非主キーを指す結合列を使用することはできません。 Doctrine はこれらが主キーであると認識し、データを使用して遅延読み込みプロキシを作成します。これにより、予期しない結果が生じる可能性があります。 Doctrine はパフォーマンス上の理由から、実行時にこの設定の正しさを検証するのではなく、Validate Schema コマンドを介してのみ検証できます。

29.1.2. Mapping Arrays to a Join Table

Related to the previous limitation with “Foreign Keys as Identifier” you might be interested in mapping the same table structure as given above to an array. However this is not yet possible either. See the following example:

「識別子としての外部キー」に関する以前の制限に関連して、上記と同じテーブル構造を配列にマッピングすることに関心があるかもしれません。ただし、これもまだ可能ではありません。次の例を参照してください。

CREATE TABLE product (
    id INTEGER,
    name VARCHAR,
    PRIMARY KEY(id)
);

CREATE TABLE product_attributes (
    product_id INTEGER,
    attribute_name VARCHAR,
    attribute_value VARCHAR,
    PRIMARY KEY (product_id, attribute_name)
);

This schema should be mapped to a Product Entity as follows:

このスキーマは、次のように製品エンティティにマップする必要があります。

class Product
{
    private $id;
    private $name;
    private $attributes = array();
}

Where the attribute_name column contains the key and attribute_value contains the value of each array element in $attributes.

attribute_name 列にはキーが含まれ、attribute_value には $attributes の各配列要素の値が含まれます。

The feature request for persistence of primitive value arrays is described in the DDC-298 ticket.

プリミティブ値配列の永続化機能のリクエストは、DDC-298 チケットに記載されています。

29.1.3. Cascade Merge with Bi-directional Associations

There are two bugs now that concern the use of cascade merge in combination with bi-directional associations. Make sure to study the behavior of cascade merge if you are using it:

現在、カスケード マージを双方向の関連付けと組み合わせて使用​​することに関連する 2 つのバグがあります。カスケード マージを使用している場合は、カスケード マージの動作を確認してください。

  • DDC-875 Merge can sometimes add the same entity twice into a collection

    DDC-875 Merge が同じエンティティをコレクションに 2 回追加することがある

  • DDC-763 Cascade merge on associated entities can insert too many rows through “Persistence by Reachability”

    DDC-763 関連付けられたエンティティのカスケード マージで、「到達可能性による持続性」を介して挿入される行が多すぎることがある

29.1.4. Custom Persisters

A Persister in Doctrine is an object that is responsible for the hydration and write operations of an entity against the database. Currently there is no way to overwrite the persister implementation for a given entity, however there are several use-cases that can benefit from custom persister implementations:

Doctrine の Persister は、データベースに対するエンティティのハイドレーションおよび書き込み操作を担当するオブジェクトです。現在、特定のエンティティの永続化実装を上書きする方法はありませんが、カスタム永続化実装の恩恵を受けることができるいくつかのユースケースがあります。

29.1.5. Persist Keys of Collections

PHP Arrays are ordered hash-maps and so should be the Doctrine\Common\Collections\Collection interface. We plan to evaluate a feature that optionally persists and hydrates the keys of a Collection instance.

PHP 配列は順序付けられたハッシュ マップであるため、Doctrine\Common\Collections\Collection インターフェイスである必要があります。オプションで Collection インスタンスのキーを永続化およびハイドレートする機能を評価する予定です。

Ticket DDC-213

チケット DDC-213

29.1.6. Mapping many tables to one entity

It is not possible to map several equally looking tables onto one entity. For example if you have a production and an archive table of a certain business concept then you cannot have both tables map to the same entity.

同じように見える複数のテーブルを 1 つのエンティティにマップすることはできません。たとえば、特定のビジネス コンセプトのプロダクション テーブルとアーカイブ テーブルがある場合、両方のテーブルを同じエンティティにマップすることはできません。

29.1.7. Behaviors

Doctrine ORM will never include a behavior system like Doctrine 1 in the core library. We don’t think behaviors add more value than they cost pain and debugging hell. Please see the many different blog posts we have written on this topics:

Doctrine ORM は Doctrine 1 のような動作システムをコア ライブラリに含めることは決してありません。私たちは、動作が苦痛とデバッグ地獄を犠牲にする以上の価値をもたらすとは考えていません。このトピックについて私たちが書いたさまざまなブログ投稿をご覧ください。

Doctrine ORM has enough hooks and extension points so that you can add whatever you want on top of it. None of this will ever become core functionality of Doctrine2 however, you will have to rely on third party extensions for magical behaviors.

Doctrine ORM には十分なフックと拡張ポイントがあり、その上に必要なものを追加できます。これが Doctrine2 のコア機能になることはありませんが、魔法の動作についてはサードパーティの拡張機能に依存する必要があります。

29.1.8. Nested Set

NestedSet was offered as a behavior in Doctrine 1 and will not be included in the core of Doctrine ORM. However there are already two extensions out there that offer support for Nested Set with ORM:

NestedSet は Doctrine 1 の振る舞いとして提供され、Doctrine ORM のコアには含まれません。ただし、ネストされたセット withORM のサポートを提供する 2 つの拡張機能が既に存在します。

29.2. Known Issues

The Known Issues section describes critical/blocker bugs and other issues that are either complicated to fix, not fixable due to backwards compatibility issues or where no simple fix exists (yet). We don’t plan to add every bug in the tracker there, just those issues that can potentially cause nightmares or pain of any sort.

既知の問題セクションでは、修正が複雑な問題、後方互換性の問題のために修正できない問題、または単純な修正が (まだ) 存在しない重要なバグやブロッカー バグ、およびその他の問題について説明します。トラッカーにすべてのバグを追加する予定はありません。悪夢やあらゆる種類の痛みを引き起こす可能性があります。

See bugs, improvement and feature requests on Github issues.

Github の問題に関するバグ、改善、および機能のリクエストを参照してください。

29.2.1. Identifier Quoting and Legacy Databases

For compatibility reasons between all the supported vendors and edge case problems Doctrine ORM does NOT do automatic identifier quoting. This can lead to problems when trying to get legacy-databases to work with Doctrine ORM.

サポートされているすべてのベンダーとエッジケースの問題との間の互換性の理由から、Doctrine ORM は自動識別子引用を行いません。これは、Doctrine ORM で動作するようにレガシー データベースを取得しようとするときに問題を引き起こす可能性があります。

  • You can quote column-names as described in the Basic-Mapping section.

    Basic-Mapping セクションで説明されているように、列名を引用できます。

  • You cannot quote join column names.

    結合列名を引用することはできません。

  • You cannot use non [a-zA-Z0-9_]+ characters, they will break several SQL statements.

    [a-zA-Z0-9_]+ 文字以外は使用できません。これらの文字はいくつかの SQL ステートメントを壊します。

Having problems with these kind of column names? Many databases support all CRUD operations on views that semantically map to certain tables. You can create views for all your problematic tables and column names to avoid the legacy quoting nightmare.

この種の列名に問題がありますか?多くのデータベースは、特定のテーブルにセマンティックにマップするビューに対するすべての CRUD 操作をサポートしています。問題のあるすべてのテーブルと列名のビューを作成して、従来の引用の悪夢を回避できます。

29.2.2. Microsoft SQL Server and Doctrine “datetime”

Doctrine assumes that you use DateTime2 data-types. If your legacy database contains DateTime datatypes then you have to add your own data-type (see Basic Mapping for an example).

Doctrine は、DateTime2 データ型を使用することを前提としています。レガシー データベースに DateTime データ型が含まれている場合は、独自のデータ型を追加する必要があります (例については、基本的なマッピングを参照してください)。

29.2.3. MySQL with MyISAM tables

Doctrine cannot provide atomic operations when calling EntityManager#flush() if one of the tables involved uses the storage engine MyISAM. You must use InnoDB or other storage engines that support transactions if you need integrity.

関連するテーブルの 1 つがストレージ エンジン MyISAM を使用している場合、Doctrine は EntityManager#flush() を呼び出すときにアトミック操作を提供できません。整合性が必要な場合は、トランザクションをサポートする InnoDB またはその他のストレージ エンジンを使用する必要があります。

Table Of Contents

Previous topic

28. Best Practices

28. ベストプラクティス

Next topic

31. Filters

31. フィルター

This Page

Fork me on GitHub