mirror of
https://github.com/doctrine/orm.git
synced 2026-04-23 14:38:03 +02:00
Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c351e0444 | |||
| 5ed5383338 | |||
| eb1d54871b | |||
| e148c838b0 | |||
| c73df2a7b4 | |||
| 38682e93db | |||
| 84df37de97 | |||
| 856c3143f8 | |||
| 79f73a23f3 | |||
| 4af912f712 | |||
| 65f48e0ecd | |||
| 193c3abf0e | |||
| 5b8263e8fb | |||
| 26e85b8c88 | |||
| 152c04c03d | |||
| 12ab6fa43f | |||
| e8e61cbbd5 | |||
| 8f847cb5aa | |||
| 599832cb81 | |||
| 530f515556 | |||
| 1c55025b12 | |||
| 0900d4bc97 | |||
| be2518d784 | |||
| bdd8883d12 | |||
| 536b65f02b | |||
| 103c42cdb7 | |||
| cdaf7b5308 | |||
| 4b88ce787d | |||
| f9c3470a8d | |||
| c1b131b67e | |||
| 16b82ea061 | |||
| f8f370ace6 | |||
| d5c69fb73f | |||
| 93f9eb7af2 | |||
| 6d5da83c68 | |||
| 5f01dd8d09 | |||
| b596e6a665 | |||
| 79d3cf5880 | |||
| d7b7c28ae5 | |||
| d6fd510c49 | |||
| a2a7d5bb01 | |||
| 223b2650c4 | |||
| 01c1644d9c | |||
| 3eff2d4b3f | |||
| 9ddf8b96f8 | |||
| 3d00fa817a | |||
| c0a1404e4c |
@@ -30,7 +30,7 @@ jobs:
|
||||
- php-version: "8.0"
|
||||
dbal-version: "2.13"
|
||||
- php-version: "8.1"
|
||||
dbal-version: "3.2@dev"
|
||||
dbal-version: "3@dev"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
@@ -78,16 +78,16 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.4"
|
||||
- "8.1"
|
||||
dbal-version:
|
||||
- "default"
|
||||
postgres-version:
|
||||
- "9.6"
|
||||
- "13"
|
||||
- "14"
|
||||
include:
|
||||
- php-version: "8.0"
|
||||
dbal-version: "2.13"
|
||||
postgres-version: "13"
|
||||
postgres-version: "14"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
@@ -139,18 +139,18 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.4"
|
||||
- "8.1"
|
||||
dbal-version:
|
||||
- "default"
|
||||
mariadb-version:
|
||||
- "10.5"
|
||||
- "10.6"
|
||||
extension:
|
||||
- "mysqli"
|
||||
- "pdo_mysql"
|
||||
include:
|
||||
- php-version: "8.0"
|
||||
dbal-version: "2.13"
|
||||
mariadb-version: "10.5"
|
||||
mariadb-version: "10.6"
|
||||
extension: "pdo_mysql"
|
||||
|
||||
services:
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.4"
|
||||
- "8.1"
|
||||
dbal-version:
|
||||
- "default"
|
||||
mysql-version:
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@ vendor/
|
||||
/tests/Doctrine/Performance/history.db
|
||||
/.phpcs-cache
|
||||
composer.lock
|
||||
/.phpunit.result.cache
|
||||
.phpunit.result.cache
|
||||
/*.phpunit.xml
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
failOnRisky="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<var name="db_driver" value="mysqli"/>
|
||||
<var name="db_host" value="127.0.0.1" />
|
||||
<var name="db_port" value="3306"/>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
failOnRisky="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<var name="db_driver" value="pdo_mysql"/>
|
||||
<var name="db_host" value="127.0.0.1" />
|
||||
<var name="db_port" value="3306"/>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
failOnRisky="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<var name="db_driver" value="pdo_pgsql"/>
|
||||
<var name="db_host" value="localhost" />
|
||||
<var name="db_user" value="postgres" />
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
failOnRisky="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<!-- use an in-memory sqlite database -->
|
||||
<var name="db_driver" value="pdo_sqlite"/>
|
||||
<var name="db_memory" value="true"/>
|
||||
|
||||
+2
-3
@@ -23,7 +23,6 @@
|
||||
"php": "^7.1 || ^8.0",
|
||||
"composer-runtime-api": "^2",
|
||||
"ext-ctype": "*",
|
||||
"ext-pdo": "*",
|
||||
"doctrine/cache": "^1.12.1 || ^2.1.1",
|
||||
"doctrine/collections": "^1.5",
|
||||
"doctrine/common": "^3.0.3",
|
||||
@@ -43,12 +42,12 @@
|
||||
"doctrine/annotations": "^1.13",
|
||||
"doctrine/coding-standard": "^9.0",
|
||||
"phpbench/phpbench": "^0.16.10 || ^1.0",
|
||||
"phpstan/phpstan": "1.3.3",
|
||||
"phpstan/phpstan": "1.4.6",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
|
||||
"squizlabs/php_codesniffer": "3.6.2",
|
||||
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
|
||||
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
|
||||
"vimeo/psalm": "4.18.1"
|
||||
"vimeo/psalm": "4.22.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/annotations": "<1.13 || >= 2.0"
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
Accessing private/protected properties/methods of the same class from different instance
|
||||
========================================================================================
|
||||
|
||||
.. sectionauthor:: Michael Olsavsky (olsavmic)
|
||||
|
||||
As explained in the :doc:`restrictions for entity classes in the manual <../reference/architecture>`,
|
||||
it is dangerous to access private/protected properties of different entity instance of the same class because of lazy loading.
|
||||
|
||||
The proxy instance that's injected instead of the real entity may not be initialized yet
|
||||
and therefore not contain expected data which may result in unexpected behavior.
|
||||
That's a limitation of current proxy implementation - only public methods automatically initialize proxies.
|
||||
|
||||
It is usually preferable to use a public interface to manipulate the object from outside the `$this`
|
||||
context but it may not be convenient in some cases. The following example shows how to do it safely.
|
||||
|
||||
Safely accessing private properties from different instance of the same class
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
To safely access private property of different instance of the same class, make sure to initialise
|
||||
the proxy before use manually as follows:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
use Doctrine\Common\Proxy\Proxy;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Entity
|
||||
{
|
||||
// ...
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Entity")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private self $parent;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
*/
|
||||
private string $name;
|
||||
|
||||
// ...
|
||||
|
||||
public function doSomethingWithParent()
|
||||
{
|
||||
// Always initializing the proxy before use
|
||||
if ($this->parent instanceof Proxy) {
|
||||
$this->parent->__load();
|
||||
}
|
||||
|
||||
// Accessing the `$this->parent->name` property without loading the proxy first
|
||||
// may throw error in case the Proxy has not been initialized yet.
|
||||
$this->parent->name;
|
||||
}
|
||||
|
||||
public function doSomethingWithAnotherInstance(self $instance)
|
||||
{
|
||||
// Always initializing the proxy before use
|
||||
if ($instance instanceof Proxy) {
|
||||
$instance->__load();
|
||||
}
|
||||
|
||||
// Accessing the `$instance->name` property without loading the proxy first
|
||||
// may throw error in case the Proxy has not been initialized yet.
|
||||
$instance->name;
|
||||
}
|
||||
|
||||
// ...
|
||||
}
|
||||
@@ -195,10 +195,7 @@ SQL Logger (***Optional***)
|
||||
|
||||
Gets or sets the logger to use for logging all SQL statements
|
||||
executed by Doctrine. The logger class must implement the
|
||||
``Doctrine\DBAL\Logging\SQLLogger`` interface. A simple default
|
||||
implementation that logs to the standard output using ``echo`` and
|
||||
``var_dump`` can be found at
|
||||
``Doctrine\DBAL\Logging\EchoSQLLogger``.
|
||||
deprecated ``Doctrine\DBAL\Logging\SQLLogger`` interface.
|
||||
|
||||
Auto-generating Proxy Classes (***OPTIONAL***)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -82,9 +82,13 @@ be any regular PHP class observing the following restrictions:
|
||||
:doc:`do so safely <../cookbook/implementing-wakeup-or-clone>`.
|
||||
- An entity class must not implement ``__wakeup`` or
|
||||
:doc:`do so safely <../cookbook/implementing-wakeup-or-clone>`.
|
||||
Also consider implementing
|
||||
`Serializable <https://php.net/manual/en/class.serializable.php>`_
|
||||
instead.
|
||||
You can also consider implementing
|
||||
`Serializable <https://php.net/manual/en/class.serializable.php>`_,
|
||||
but be aware that it is deprecated since PHP 8.1. We do not recommend its usage.
|
||||
- PHP 7.4 introduces :doc:`the new magic method <https://php.net/manual/en/language.oop5.magic.php#object.unserialize>`
|
||||
``__unserialize``, which changes the execution priority between
|
||||
``__wakeup`` and itself when used. This can cause unexpected behaviour in
|
||||
an Entity.
|
||||
- Any two entity classes in a class hierarchy that inherit
|
||||
directly or indirectly from one another must not have a mapped
|
||||
property with the same name. That is, if B inherits from A then B
|
||||
@@ -93,6 +97,7 @@ be any regular PHP class observing the following restrictions:
|
||||
- An entity cannot make use of func_get_args() to implement variable parameters.
|
||||
Generated proxies do not support this for performance reasons and your code might
|
||||
actually fail to work when violating this restriction.
|
||||
- Entity cannot access private/protected properties/methods of another entity of the same class or :doc:`do so safely <../cookbook/accessing-private-properties-of-the-same-class-from-different-instance>`.
|
||||
|
||||
Entities support inheritance, polymorphic associations, and
|
||||
polymorphic queries. Both abstract and concrete classes can be
|
||||
@@ -161,7 +166,8 @@ possible for ``__sleep`` to return names of private properties in
|
||||
parent classes. On the other hand it is not a solution for proxy
|
||||
objects to implement ``Serializable`` because Serializable does not
|
||||
work well with any potential cyclic object references (at least we
|
||||
did not find a way yet, if you did, please contact us).
|
||||
did not find a way yet, if you did, please contact us). The
|
||||
``Serializable`` interface is also deprecated beginning with PHP 8.1.
|
||||
|
||||
The EntityManager
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -570,7 +570,7 @@ Example with partial indexes:
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Index;
|
||||
|
||||
#[Index(name: "search_idx", columns: {"category"},
|
||||
#[Index(name: "search_idx", columns: ["category"],
|
||||
options: [
|
||||
"where": "((category IS NOT NULL))"
|
||||
]
|
||||
@@ -628,7 +628,7 @@ Examples:
|
||||
#[Entity]
|
||||
#[InheritanceType("SINGLE_TABLE")]
|
||||
#[DiscriminatorColumn(name: "discr", type: "string")]
|
||||
#[DiscriminatorMap({"person" = "Person", "employee" = "Employee"})]
|
||||
#[DiscriminatorMap(["person" => "Person", "employee" => "Employee"])]
|
||||
class Person
|
||||
{
|
||||
// ...
|
||||
@@ -637,7 +637,7 @@ Examples:
|
||||
#[Entity]
|
||||
#[InheritanceType("JOINED")]
|
||||
#[DiscriminatorColumn(name: "discr", type: "string")]
|
||||
#[DiscriminatorMap({"person" = "Person", "employee" = "Employee"})]
|
||||
#[DiscriminatorMap(["person" => "Person", "employee" => "Employee"])]
|
||||
class Person
|
||||
{
|
||||
// ...
|
||||
|
||||
@@ -14,17 +14,11 @@ After working through this guide you should know:
|
||||
Mapping of associations will be covered in the next chapter on
|
||||
:doc:`Association Mapping <association-mapping>`.
|
||||
|
||||
Guide Assumptions
|
||||
-----------------
|
||||
|
||||
You should have already :doc:`installed and configure <configuration>`
|
||||
Doctrine.
|
||||
|
||||
Creating Classes for the Database
|
||||
---------------------------------
|
||||
|
||||
Every PHP object that you want to save in the database using Doctrine
|
||||
is called an "Entity". The term "Entity" describes objects
|
||||
is called an *Entity*. The term "Entity" describes objects
|
||||
that have an identity over many independent requests. This identity is
|
||||
usually achieved by assigning a unique identifier to an entity.
|
||||
In this tutorial the following ``Message`` PHP class will serve as the
|
||||
@@ -50,11 +44,11 @@ that describes your entity.
|
||||
Doctrine provides several different ways to specify object-relational
|
||||
mapping metadata:
|
||||
|
||||
- :doc:`Docblock Annotations <annotations-reference>`
|
||||
- :doc:`Attributes <attributes-reference>`
|
||||
- :doc:`Docblock Annotations <annotations-reference>`
|
||||
- :doc:`XML <xml-mapping>`
|
||||
- :doc:`YAML <yaml-mapping>`
|
||||
- :doc:`PHP code <php-mapping>`
|
||||
- :doc:`YAML <yaml-mapping>` (deprecated and will be removed in ``doctrine/orm`` 3.0.)
|
||||
|
||||
This manual will usually show mapping metadata via docblock annotations, though
|
||||
many examples also show the equivalent configuration in YAML and XML.
|
||||
@@ -62,8 +56,8 @@ many examples also show the equivalent configuration in YAML and XML.
|
||||
.. note::
|
||||
|
||||
All metadata drivers perform equally. Once the metadata of a class has been
|
||||
read from the source (annotations, xml or yaml) it is stored in an instance
|
||||
of the ``Doctrine\ORM\Mapping\ClassMetadata`` class and these instances are
|
||||
read from the source (attributes, annotations, XML, etc.) it is stored in an instance
|
||||
of the ``Doctrine\ORM\Mapping\ClassMetadata`` class which are
|
||||
stored in the metadata cache. If you're not using a metadata cache (not
|
||||
recommended!) then the XML driver is the fastest.
|
||||
|
||||
@@ -71,9 +65,22 @@ Marking our ``Message`` class as an entity for Doctrine is straightforward:
|
||||
|
||||
.. configuration-block::
|
||||
|
||||
.. code-block:: php
|
||||
.. code-block:: attribute
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
|
||||
#[Entity]
|
||||
class Message
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
.. code-block:: annotation
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
|
||||
/** @Entity */
|
||||
class Message
|
||||
{
|
||||
@@ -100,9 +107,25 @@ You can change this by configuring information about the table:
|
||||
|
||||
.. configuration-block::
|
||||
|
||||
.. code-block:: php
|
||||
.. code-block:: attribute
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\Table;
|
||||
|
||||
#[Entity]
|
||||
#[Table(name: 'message')]
|
||||
class Message
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
.. code-block:: annotation
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\Table;
|
||||
|
||||
/**
|
||||
* @Entity
|
||||
* @Table(name="message")
|
||||
@@ -132,19 +155,38 @@ Now the class ``Message`` will be saved and fetched from the table ``message``.
|
||||
Property Mapping
|
||||
----------------
|
||||
|
||||
The next step after marking a PHP class as an entity is mapping its properties
|
||||
to columns in a table.
|
||||
The next step is mapping its properties to columns in the table.
|
||||
|
||||
To configure a property use the ``@Column`` docblock annotation. The ``type``
|
||||
To configure a property use the ``Column`` docblock annotation. The ``type``
|
||||
attribute specifies the :ref:`Doctrine Mapping Type <reference-mapping-types>`
|
||||
to use for the field. If the type is not specified, ``string`` is used as the
|
||||
default.
|
||||
|
||||
.. configuration-block::
|
||||
|
||||
.. code-block:: php
|
||||
.. code-block:: attribute
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
||||
#[Entity]
|
||||
class Message
|
||||
{
|
||||
#[Column(type: Types::INTEGER)]
|
||||
private $id;
|
||||
#[Column(length: 140)]
|
||||
private $text;
|
||||
#[Column(name: 'posted_at', type: Types::DATETIME)]
|
||||
private $postedAt;
|
||||
}
|
||||
|
||||
.. code-block:: annotation
|
||||
|
||||
<?php
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
|
||||
/** @Entity */
|
||||
class Message
|
||||
{
|
||||
@@ -180,42 +222,34 @@ default.
|
||||
column: posted_at
|
||||
|
||||
When we don't explicitly specify a column name via the ``name`` option, Doctrine
|
||||
assumes the field name is also the column name. This means that:
|
||||
assumes the field name is also the column name. So in this example:
|
||||
|
||||
* the ``id`` property will map to the column ``id`` using the type ``integer``;
|
||||
* the ``text`` property will map to the column ``text`` with the default mapping type ``string``;
|
||||
* the ``postedAt`` property will map to the ``posted_at`` column with the ``datetime`` type.
|
||||
|
||||
The Column annotation has some more attributes. Here is a complete
|
||||
list:
|
||||
Here is a complete list of ``Column``s attributes (all optional):
|
||||
|
||||
- ``type``: (optional, defaults to 'string') The mapping type to
|
||||
use for the column.
|
||||
- ``name``: (optional, defaults to field name) The name of the
|
||||
column in the database.
|
||||
- ``length``: (optional, default 255) The length of the column in
|
||||
the database. (Applies only if a string-valued column is used).
|
||||
- ``unique``: (optional, default FALSE) Whether the column is a
|
||||
unique key.
|
||||
- ``nullable``: (optional, default FALSE) Whether the database
|
||||
column is nullable.
|
||||
- ``insertable``: (optional, default TRUE) Whether the database
|
||||
column should be inserted.
|
||||
- ``updatable``: (optional, default TRUE) Whether the database
|
||||
column should be updated.
|
||||
- ``enumType``: (optional, requires PHP 8.1 and ORM 2.11) The PHP enum type
|
||||
name to convert the database value into.
|
||||
- ``precision``: (optional, default 0) The precision for a decimal
|
||||
(exact numeric) column (applies only for decimal column),
|
||||
- ``type`` (default: 'string'): The mapping type to use for the column.
|
||||
- ``name`` (default: name of property): The name of the column in the database.
|
||||
- ``length`` (default: 255): The length of the column in the database.
|
||||
Applies only if a string-valued column is used.
|
||||
- ``unique`` (default: ``false``): Whether the column is a unique key.
|
||||
- ``nullable`` (default: ``false``): Whether the column is nullable.
|
||||
- ``insertable`` (default: ``true``): Whether the column should be inserted.
|
||||
- ``updatable`` (default: ``true``): Whether the column should be updated.
|
||||
- ``enumType`` (requires PHP 8.1 and ``doctrine/orm`` 2.11): The PHP enum class name to convert the database value into.
|
||||
- ``precision`` (default: 0): The precision for a decimal (exact numeric) column
|
||||
(applies only for decimal column),
|
||||
which is the maximum number of digits that are stored for the values.
|
||||
- ``scale``: (optional, default 0) The scale for a decimal (exact
|
||||
- ``scale`` (default: 0): The scale for a decimal (exact
|
||||
numeric) column (applies only for decimal column), which represents
|
||||
the number of digits to the right of the decimal point and must
|
||||
not be greater than *precision*.
|
||||
- ``columnDefinition``: (optional) Allows to define a custom
|
||||
not be greater than ``precision``.
|
||||
- ``columnDefinition``: Allows to define a custom
|
||||
DDL snippet that is used to create the column. Warning: This normally
|
||||
confuses the SchemaTool to always detect the column as changed.
|
||||
- ``options``: (optional) Key-value pairs of options that get passed
|
||||
confuses the :doc:`SchemaTool <tools>` to always detect the column as changed.
|
||||
- ``options``: Key-value pairs of options that get passed
|
||||
to the underlying database platform when generating DDL statements.
|
||||
|
||||
.. _reference-php-mapping-types:
|
||||
@@ -223,21 +257,32 @@ list:
|
||||
PHP Types Mapping
|
||||
_________________
|
||||
|
||||
Since version 2.9 Doctrine can determine usable defaults from property types
|
||||
on entity classes. When property type is nullable this has no effect on
|
||||
``nullable`` Column attribute at the moment for backwards compatibility
|
||||
reasons.
|
||||
.. versionadded:: 2.9
|
||||
|
||||
Additionally, Doctrine will map PHP types to ``type`` attribute as follows:
|
||||
The column types can be inferred automatically from PHP's property types.
|
||||
However, when the property type is nullable this has no effect on the ``nullable`` Column attribute.
|
||||
|
||||
- ``DateInterval``: ``dateinterval``
|
||||
- ``DateTime``: ``datetime``
|
||||
- ``DateTimeImmutable``: ``datetime_immutable``
|
||||
- ``array``: ``json``
|
||||
- ``bool``: ``boolean``
|
||||
- ``float``: ``float``
|
||||
- ``int``: ``integer``
|
||||
- ``string`` or any other type: ``string``
|
||||
These are the "automatic" mapping rules:
|
||||
|
||||
+-----------------------+-------------------------------+
|
||||
| PHP property type | Doctrine column type |
|
||||
+=======================+===============================+
|
||||
| ``DateInterval`` | ``Types::DATEINTERVAL`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``DateTime`` | ``Types::DATETIME_MUTABLE`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``DateTimeImmutable`` | ``Types::DATETIME_IMMUTABLE`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``array`` | ``Types::JSON`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``bool`` | ``Types::BOOLEAN`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``float`` | ``Types::FLOAT`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| ``int`` | ``Types::INTEGER`` |
|
||||
+-----------------------+-------------------------------+
|
||||
| Any other type | ``Types::STRING`` |
|
||||
+-----------------------+-------------------------------+
|
||||
|
||||
As of version 2.11 Doctrine can also automatically map typed properties using a
|
||||
PHP 8.1 enum to set the right ``type`` and ``enumType``.
|
||||
|
||||
@@ -13,7 +13,7 @@ as you want, or just pick a preferred one.
|
||||
|
||||
The ``QueryBuilder`` is not an abstraction of DQL, but merely a tool to dynamically build it.
|
||||
You should still use plain DQL when you can, as it is simpler and more readable.
|
||||
More about this in the :doc:`FAQ <faq>`_.
|
||||
More about this in the :doc:`FAQ <faq>`.
|
||||
|
||||
Constructing a new QueryBuilder object
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -694,6 +694,7 @@ specified by their respective tags:
|
||||
- ``<cascade-merge />``
|
||||
- ``<cascade-remove />``
|
||||
- ``<cascade-refresh />``
|
||||
- ``<cascade-detach />``
|
||||
|
||||
Join Column Element
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -81,10 +81,11 @@ that directory with the following contents:
|
||||
|
||||
{
|
||||
"require": {
|
||||
"doctrine/orm": "^2.10.2",
|
||||
"doctrine/dbal": "^3.1.1",
|
||||
"symfony/yaml": "2.*",
|
||||
"symfony/cache": "^5.3"
|
||||
"doctrine/orm": "^2.11.0",
|
||||
"doctrine/dbal": "^3.2",
|
||||
"doctrine/annotations": "1.13.2",
|
||||
"symfony/yaml": "^5.4",
|
||||
"symfony/cache": "^5.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {"": "src/"}
|
||||
|
||||
@@ -371,11 +371,11 @@ abstract class AbstractQuery
|
||||
/**
|
||||
* Sets a query parameter.
|
||||
*
|
||||
* @param string|int $key The parameter position or name.
|
||||
* @param mixed $value The parameter value.
|
||||
* @param string|null $type The parameter type. If specified, the given value will be run through
|
||||
* the type conversion of this type. This is usually not needed for
|
||||
* strings and numeric types.
|
||||
* @param string|int $key The parameter position or name.
|
||||
* @param mixed $value The parameter value.
|
||||
* @param string|int|null $type The parameter type. If specified, the given value will be run through
|
||||
* the type conversion of this type. This is usually not needed for
|
||||
* strings and numeric types.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ interface EntityHydrator
|
||||
* @param ClassMetadata $metadata The entity metadata.
|
||||
* @param EntityCacheKey $key The entity cache key.
|
||||
* @param EntityCacheEntry $entry The entity cache entry.
|
||||
* @param object $entity The entity to load the cache into. If not specified, a new entity is created.
|
||||
* @param object|null $entity The entity to load the cache into. If not specified, a new entity is created.
|
||||
*
|
||||
* @return object|null
|
||||
*/
|
||||
|
||||
@@ -39,11 +39,13 @@ use Doctrine\ORM\Repository\DefaultRepositoryFactory;
|
||||
use Doctrine\ORM\Repository\RepositoryFactory;
|
||||
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use LogicException;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use ReflectionClass;
|
||||
|
||||
use function class_exists;
|
||||
use function method_exists;
|
||||
use function sprintf;
|
||||
use function strtolower;
|
||||
use function trim;
|
||||
|
||||
@@ -162,6 +164,14 @@ class Configuration extends \Doctrine\DBAL\Configuration
|
||||
*/
|
||||
public function newDefaultAnnotationDriver($paths = [], $useSimpleAnnotationReader = true)
|
||||
{
|
||||
if (! class_exists(AnnotationReader::class)) {
|
||||
throw new LogicException(sprintf(
|
||||
'The annotation metadata driver cannot be enabled because the "doctrine/annotations" library'
|
||||
. ' is not installed. Please run "composer require doctrine/annotations" or choose a different'
|
||||
. ' metadata driver.'
|
||||
));
|
||||
}
|
||||
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');
|
||||
|
||||
if ($useSimpleAnnotationReader) {
|
||||
|
||||
@@ -59,9 +59,9 @@ class ClassMetadataBuilder
|
||||
/**
|
||||
* Adds and embedded class
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param string $class
|
||||
* @param string|null $columnPrefix
|
||||
* @param string $fieldName
|
||||
* @param string $class
|
||||
* @param string|false|null $columnPrefix
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
@@ -1056,9 +1056,19 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
|
||||
foreach ($this->fieldMappings as $field => $mapping) {
|
||||
if (isset($mapping['declaredField']) && isset($parentReflFields[$mapping['declaredField']])) {
|
||||
$childProperty = $this->getAccessibleProperty($reflService, $mapping['originalClass'], $mapping['originalField']);
|
||||
assert($childProperty !== null);
|
||||
|
||||
if (isset($mapping['enumType'])) {
|
||||
$childProperty = new ReflectionEnumProperty(
|
||||
$childProperty,
|
||||
$mapping['enumType']
|
||||
);
|
||||
}
|
||||
|
||||
$this->reflFields[$field] = new ReflectionEmbeddedProperty(
|
||||
$parentReflFields[$mapping['declaredField']],
|
||||
$this->getAccessibleProperty($reflService, $mapping['originalClass'], $mapping['originalField']),
|
||||
$childProperty,
|
||||
$mapping['originalClass']
|
||||
);
|
||||
continue;
|
||||
@@ -1517,7 +1527,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
! isset($mapping['type'])
|
||||
&& ($type instanceof ReflectionNamedType)
|
||||
) {
|
||||
if (PHP_VERSION_ID >= 80100 && ! $type->isBuiltin() && enum_exists($type->getName(), false)) {
|
||||
if (PHP_VERSION_ID >= 80100 && ! $type->isBuiltin() && enum_exists($type->getName())) {
|
||||
$mapping['enumType'] = $type->getName();
|
||||
|
||||
$reflection = new ReflectionEnum($type->getName());
|
||||
|
||||
@@ -15,13 +15,13 @@ use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
final class DiscriminatorColumn implements Annotation
|
||||
{
|
||||
/** @var string */
|
||||
/** @var string|null */
|
||||
public $name;
|
||||
|
||||
/** @var string */
|
||||
/** @var string|null */
|
||||
public $type;
|
||||
|
||||
/** @var int */
|
||||
/** @var int|null */
|
||||
public $length;
|
||||
|
||||
/**
|
||||
|
||||
@@ -281,7 +281,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
|
||||
[
|
||||
'name' => $discrColumnAnnot->name,
|
||||
'type' => $discrColumnAnnot->type ?: 'string',
|
||||
'length' => $discrColumnAnnot->length ?: 255,
|
||||
'length' => $discrColumnAnnot->length ?? 255,
|
||||
'columnDefinition' => $discrColumnAnnot->columnDefinition,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -11,6 +11,7 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver;
|
||||
use LogicException;
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
use ReflectionProperty;
|
||||
@@ -20,6 +21,9 @@ use function class_exists;
|
||||
use function constant;
|
||||
use function defined;
|
||||
use function get_class;
|
||||
use function sprintf;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
class AttributeDriver extends AnnotationDriver
|
||||
{
|
||||
@@ -35,6 +39,13 @@ class AttributeDriver extends AnnotationDriver
|
||||
*/
|
||||
public function __construct(array $paths)
|
||||
{
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
throw new LogicException(sprintf(
|
||||
'The attribute metadata driver cannot be enabled on PHP 7. Please upgrade to PHP 8 or choose a different'
|
||||
. ' metadata driver.'
|
||||
));
|
||||
}
|
||||
|
||||
parent::__construct(new AttributeReader(), $paths);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\Mapping\Driver\FileDriver;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
use SimpleXMLElement;
|
||||
|
||||
use function assert;
|
||||
@@ -18,6 +19,7 @@ use function constant;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function explode;
|
||||
use function extension_loaded;
|
||||
use function file_get_contents;
|
||||
use function in_array;
|
||||
use function simplexml_load_string;
|
||||
@@ -39,6 +41,13 @@ class XmlDriver extends FileDriver
|
||||
*/
|
||||
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
||||
{
|
||||
if (! extension_loaded('simplexml')) {
|
||||
throw new LogicException(sprintf(
|
||||
'The XML metadata driver cannot be enabled because the SimpleXML PHP extension is missing.'
|
||||
. ' Please configure PHP with SimpleXML or choose a different metadata driver.'
|
||||
));
|
||||
}
|
||||
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\Mapping\Driver\FileDriver;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
use function array_map;
|
||||
use function class_exists;
|
||||
use function constant;
|
||||
use function defined;
|
||||
use function explode;
|
||||
@@ -45,6 +47,14 @@ class YamlDriver extends FileDriver
|
||||
'YAML mapping driver is deprecated and will be removed in Doctrine ORM 3.0, please migrate to attribute or XML driver.'
|
||||
);
|
||||
|
||||
if (! class_exists(Yaml::class)) {
|
||||
throw new LogicException(sprintf(
|
||||
'The YAML metadata driver cannot be enabled because the "symfony/yaml" library'
|
||||
. ' is not installed. Please run "composer require symfony/yaml" or choose a different'
|
||||
. ' metadata driver.'
|
||||
));
|
||||
}
|
||||
|
||||
parent::__construct($locator, $fileExtension);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ final class Index implements Annotation
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param array<string>|null $columns
|
||||
* @param array<string>|null $fields
|
||||
* @param array<string>|null $flags
|
||||
* @param array<string>|null $options
|
||||
* @param array<string>|null $columns
|
||||
* @param array<string>|null $fields
|
||||
* @param array<string>|null $flags
|
||||
* @param array<string,mixed>|null $options
|
||||
*/
|
||||
public function __construct(
|
||||
?array $columns = null,
|
||||
|
||||
@@ -16,7 +16,7 @@ use Doctrine\Deprecations\Deprecation;
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class ManyToMany implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
/** @var class-string|null */
|
||||
public $targetEntity;
|
||||
|
||||
/** @var string|null */
|
||||
@@ -43,7 +43,8 @@ final class ManyToMany implements Annotation
|
||||
public $indexBy;
|
||||
|
||||
/**
|
||||
* @param string[]|null $cascade
|
||||
* @param class-string|null $targetEntity
|
||||
* @param string[]|null $cascade
|
||||
*/
|
||||
public function __construct(
|
||||
?string $targetEntity = null,
|
||||
|
||||
@@ -15,7 +15,7 @@ use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class ManyToOne implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
/** @var class-string|null */
|
||||
public $targetEntity;
|
||||
|
||||
/** @var string[]|null */
|
||||
@@ -33,7 +33,8 @@ final class ManyToOne implements Annotation
|
||||
public $inversedBy;
|
||||
|
||||
/**
|
||||
* @param string[]|null $cascade
|
||||
* @param class-string|null $targetEntity
|
||||
* @param string[]|null $cascade
|
||||
*/
|
||||
public function __construct(
|
||||
?string $targetEntity = null,
|
||||
|
||||
@@ -18,7 +18,7 @@ final class OneToMany implements Annotation
|
||||
/** @var string */
|
||||
public $mappedBy;
|
||||
|
||||
/** @var string */
|
||||
/** @var class-string|null */
|
||||
public $targetEntity;
|
||||
|
||||
/** @var array<string> */
|
||||
@@ -39,7 +39,8 @@ final class OneToMany implements Annotation
|
||||
public $indexBy;
|
||||
|
||||
/**
|
||||
* @param string[]|null $cascade
|
||||
* @param class-string|null $targetEntity
|
||||
* @param string[]|null $cascade
|
||||
*/
|
||||
public function __construct(
|
||||
?string $mappedBy = null,
|
||||
|
||||
@@ -15,7 +15,7 @@ use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
final class OneToOne implements Annotation
|
||||
{
|
||||
/** @var string|null */
|
||||
/** @var class-string|null */
|
||||
public $targetEntity;
|
||||
|
||||
/** @var string|null */
|
||||
@@ -39,6 +39,7 @@ final class OneToOne implements Annotation
|
||||
public $orphanRemoval = false;
|
||||
|
||||
/**
|
||||
* @param class-string|null $targetEntity
|
||||
* @param array<string>|null $cascade
|
||||
*/
|
||||
public function __construct(
|
||||
|
||||
@@ -29,6 +29,11 @@ class ReflectionEnumProperty extends ReflectionProperty
|
||||
{
|
||||
$this->originalReflectionProperty = $originalReflectionProperty;
|
||||
$this->enumType = $enumType;
|
||||
|
||||
parent::__construct(
|
||||
$originalReflectionProperty->getDeclaringClass()->getName(),
|
||||
$originalReflectionProperty->getName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -481,6 +481,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->get($offset);
|
||||
|
||||
@@ -97,8 +97,7 @@ class FilterCollection
|
||||
// Keep the enabled filters sorted for the hash
|
||||
ksort($this->enabledFilters);
|
||||
|
||||
// Now the filter collection is dirty
|
||||
$this->filtersState = self::FILTERS_STATE_DIRTY;
|
||||
$this->setFiltersStateDirty();
|
||||
}
|
||||
|
||||
return $this->enabledFilters[$name];
|
||||
@@ -120,8 +119,7 @@ class FilterCollection
|
||||
|
||||
unset($this->enabledFilters[$name]);
|
||||
|
||||
// Now the filter collection is dirty
|
||||
$this->filtersState = self::FILTERS_STATE_DIRTY;
|
||||
$this->setFiltersStateDirty();
|
||||
|
||||
return $filter;
|
||||
}
|
||||
@@ -194,6 +192,9 @@ class FilterCollection
|
||||
$filterHash .= $name . $filter;
|
||||
}
|
||||
|
||||
$this->filterHash = $filterHash;
|
||||
$this->filtersState = self::FILTERS_STATE_CLEAN;
|
||||
|
||||
return $filterHash;
|
||||
}
|
||||
|
||||
|
||||
@@ -2809,7 +2809,7 @@ class Parser
|
||||
/**
|
||||
* SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}*
|
||||
*
|
||||
* @return SimpleArithmeticExpression
|
||||
* @return SimpleArithmeticExpression|ArithmeticTerm
|
||||
*/
|
||||
public function SimpleArithmeticExpression()
|
||||
{
|
||||
|
||||
@@ -781,12 +781,18 @@ class SchemaTool
|
||||
*/
|
||||
private function gatherColumnOptions(array $mapping): array
|
||||
{
|
||||
if (! isset($mapping['options'])) {
|
||||
$mappingOptions = $mapping['options'] ?? [];
|
||||
|
||||
if (isset($mapping['enumType'])) {
|
||||
$mappingOptions['enumType'] = $mapping['enumType'];
|
||||
}
|
||||
|
||||
if (empty($mappingOptions)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$options = array_intersect_key($mapping['options'], array_flip(self::KNOWN_COLUMN_OPTIONS));
|
||||
$options['customSchemaOptions'] = array_diff_key($mapping['options'], $options);
|
||||
$options = array_intersect_key($mappingOptions, array_flip(self::KNOWN_COLUMN_OPTIONS));
|
||||
$options['customSchemaOptions'] = array_diff_key($mappingOptions, $options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@ class SchemaValidator
|
||||
'field ' . $assoc['targetEntity'] . '#' . $assoc['inversedBy'] . ' which does not exist.';
|
||||
} elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] === null) {
|
||||
$ce[] = 'The field ' . $class->name . '#' . $fieldName . ' is on the owning side of a ' .
|
||||
'bi-directional relationship, but the specified mappedBy association on the target-entity ' .
|
||||
$assoc['targetEntity'] . '#' . $assoc['mappedBy'] . ' does not contain the required ' .
|
||||
"'inversedBy' attribute.";
|
||||
'bi-directional relationship, but the specified inversedBy association on the target-entity ' .
|
||||
$assoc['targetEntity'] . '#' . $assoc['inversedBy'] . ' does not contain the required ' .
|
||||
"'mappedBy=\"" . $fieldName . "\"' attribute.";
|
||||
} elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] !== $fieldName) {
|
||||
$ce[] = 'The mappings ' . $class->name . '#' . $fieldName . ' and ' .
|
||||
$assoc['targetEntity'] . '#' . $assoc['inversedBy'] . ' are ' .
|
||||
|
||||
@@ -197,7 +197,7 @@ class Setup
|
||||
$cache = class_exists(ArrayCache::class) ? new ArrayCache() : new ArrayAdapter();
|
||||
} elseif (extension_loaded('apcu')) {
|
||||
$cache = class_exists(ApcuCache::class) ? new ApcuCache() : new ApcuAdapter();
|
||||
} elseif (extension_loaded('memcached')) {
|
||||
} elseif (extension_loaded('memcached') && (class_exists(MemcachedCache::class) || MemcachedAdapter::isSupported())) {
|
||||
$memcached = new Memcached();
|
||||
$memcached->addServer('127.0.0.1', 11211);
|
||||
|
||||
|
||||
@@ -269,9 +269,11 @@
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect">
|
||||
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
|
||||
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
|
||||
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent.IncorrectExact">
|
||||
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/3474 -->
|
||||
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Suit.php</exclude-pattern>
|
||||
<exclude-pattern>tests/Doctrine/Tests/Models/Enums/Unit.php</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
+22
-71
@@ -130,36 +130,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:find\\(\\) should return T\\|null but returns object\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:find\\(\\) should return T\\|null but returns object\\|null\\.$#"
|
||||
count: 3
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return T\\|null but returns object\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getPartialReference\\(\\) should return T\\|null but returns object\\|null\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return T\\|null but returns Doctrine\\\\Common\\\\Proxy\\\\Proxy\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityManager\\:\\:getReference\\(\\) should return T\\|null but returns object\\|null\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManager.php
|
||||
|
||||
-
|
||||
message: "#^Result of && is always false\\.$#"
|
||||
count: 1
|
||||
@@ -175,16 +145,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityManagerInterface.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityRepository\\:\\:find\\(\\) should return T\\|null but returns object\\|null\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\EntityRepository\\:\\:findOneBy\\(\\) should return T\\|null but returns object\\|null\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/EntityRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:find\\(\\) invoked with 4 parameters, 2 required\\.$#"
|
||||
count: 1
|
||||
@@ -270,11 +230,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
|
||||
|
||||
-
|
||||
message: "#^Array \\(array\\<class\\-string, object\\>\\) does not accept key string\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Mapping/DefaultEntityListenerResolver.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:mapEmbedded\\(\\)\\.$#"
|
||||
count: 1
|
||||
@@ -705,11 +660,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/PersistentCollection.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\PersistentCollection\\:\\:slice\\(\\) should return array\\<TKey of \\(int\\|string\\), T\\> but returns array\\.$#"
|
||||
count: 2
|
||||
path: lib/Doctrine/ORM/PersistentCollection.php
|
||||
|
||||
-
|
||||
message: "#^Right side of && is always true\\.$#"
|
||||
count: 2
|
||||
@@ -725,11 +675,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php
|
||||
|
||||
-
|
||||
message: "#^Array \\(array\\<class\\-string, string\\>\\) does not accept key string\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$hints of method Doctrine\\\\ORM\\\\Internal\\\\Hydration\\\\AbstractHydrator\\:\\:hydrateAll\\(\\) expects array\\<string, string\\>, array\\<string, Doctrine\\\\ORM\\\\PersistentCollection\\|true\\> given\\.$#"
|
||||
count: 1
|
||||
@@ -930,11 +875,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/Expr/Select.php
|
||||
|
||||
-
|
||||
message: "#^Property Doctrine\\\\ORM\\\\Query\\\\FilterCollection\\:\\:\\$filterHash is never written, only read\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/FilterCollection.php
|
||||
|
||||
-
|
||||
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
||||
count: 3
|
||||
@@ -946,12 +886,7 @@ parameters:
|
||||
path: lib/Doctrine/ORM/Query/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:ArithmeticTerm\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticTerm but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticFactor\\|string\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:SimpleArithmeticExpression\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\SimpleArithmeticExpression but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticTerm\\|string\\.$#"
|
||||
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:ArithmeticTerm\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticTerm but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticFactor\\|int\\|string\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/Parser.php
|
||||
|
||||
@@ -1000,11 +935,6 @@ parameters:
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Array \\(array\\<string, array\\<int, string\\>\\|string\\>\\) does not accept key int\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Query/SqlWalker.php
|
||||
|
||||
-
|
||||
message: "#^Call to function is_string\\(\\) with Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node will always evaluate to false\\.$#"
|
||||
count: 2
|
||||
@@ -1745,6 +1675,26 @@ parameters:
|
||||
count: 2
|
||||
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'options' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'schema' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php
|
||||
|
||||
-
|
||||
message: "#^Property Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo\\<object\\>\\:\\:\\$lifecycleCallbacks \\(array\\<string, array\\<int, string\\>\\>\\) in isset\\(\\) is not nullable\\.$#"
|
||||
count: 1
|
||||
@@ -1864,3 +1814,4 @@ parameters:
|
||||
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$subClasses\\.$#"
|
||||
count: 1
|
||||
path: lib/Doctrine/ORM/Utility/HierarchyDiscriminatorResolver.php
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
colors="true"
|
||||
verbose="false"
|
||||
failOnRisky="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
bootstrap="./tests/Doctrine/Tests/TestInit.php"
|
||||
>
|
||||
<testsuites>
|
||||
@@ -32,6 +33,7 @@
|
||||
</groups>
|
||||
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<!-- "Real" test database -->
|
||||
<var name="db_driver" value="pdo_sqlite"/>
|
||||
<var name="db_memory" value="true"/>
|
||||
|
||||
+81
-54
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
|
||||
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
|
||||
<file src="lib/Doctrine/ORM/AbstractQuery.php">
|
||||
<DeprecatedClass occurrences="1">
|
||||
<code>IterableResult</code>
|
||||
@@ -703,8 +703,9 @@
|
||||
<DeprecatedConstant occurrences="1">
|
||||
<code>self::GENERATOR_TYPE_UUID</code>
|
||||
</DeprecatedConstant>
|
||||
<DeprecatedMethod occurrences="1">
|
||||
<DeprecatedMethod occurrences="2">
|
||||
<code>canEmulateSchemas</code>
|
||||
<code>canRequireSQLConversion</code>
|
||||
</DeprecatedMethod>
|
||||
<DeprecatedProperty occurrences="4">
|
||||
<code>$this->columnNames</code>
|
||||
@@ -762,7 +763,7 @@
|
||||
<code>$fieldName</code>
|
||||
<code>$fieldName</code>
|
||||
</ParamNameMismatch>
|
||||
<PossiblyNullArgument occurrences="9">
|
||||
<PossiblyNullArgument occurrences="8">
|
||||
<code>$class</code>
|
||||
<code>$className</code>
|
||||
<code>$entityResult['entityClass']</code>
|
||||
@@ -771,7 +772,6 @@
|
||||
<code>$parentReflFields[$embeddedClass['declaredField']]</code>
|
||||
<code>$parentReflFields[$mapping['declaredField']]</code>
|
||||
<code>$queryMapping['resultClass']</code>
|
||||
<code>$this->getAccessibleProperty($reflService, $mapping['originalClass'], $mapping['originalField'])</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullPropertyFetch occurrences="2">
|
||||
<code>$embeddable->reflClass->name</code>
|
||||
@@ -861,11 +861,8 @@
|
||||
</MissingClosureParamType>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Mapping/DiscriminatorColumn.php">
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="4">
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="1">
|
||||
<code>$columnDefinition</code>
|
||||
<code>$length</code>
|
||||
<code>$name</code>
|
||||
<code>$type</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php">
|
||||
@@ -1244,11 +1241,10 @@
|
||||
</MissingConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Mapping/OneToMany.php">
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="4">
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="3">
|
||||
<code>$cascade</code>
|
||||
<code>$indexBy</code>
|
||||
<code>$mappedBy</code>
|
||||
<code>$targetEntity</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php">
|
||||
@@ -1744,6 +1740,9 @@
|
||||
</ParamNameMismatch>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="1">
|
||||
<code>$simpleArithmeticExpression</code>
|
||||
</PropertyNotSetInConstructor>
|
||||
@@ -1837,15 +1836,15 @@
|
||||
</ParamNameMismatch>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
||||
<code>$parser->getLexer()->token['value']</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PossiblyNullArrayAccess occurrences="1">
|
||||
<code>$parser->getLexer()->token['value']</code>
|
||||
</PossiblyNullArrayAccess>
|
||||
<PossiblyNullArrayOffset occurrences="1">
|
||||
<code>$class->associationMappings</code>
|
||||
</PossiblyNullArrayOffset>
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="1">
|
||||
<code>$parser->getLexer()->token['value']</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="2">
|
||||
<code>$fieldMapping</code>
|
||||
<code>$pathExpression</code>
|
||||
@@ -1866,6 +1865,9 @@
|
||||
<PossiblyInvalidArgument occurrences="1">
|
||||
<code>$this->simpleArithmeticExpression</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="2">
|
||||
<code>$firstStringPrimary</code>
|
||||
<code>$secondStringPrimary</code>
|
||||
@@ -1890,6 +1892,10 @@
|
||||
</PropertyNotSetInConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="2">
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="2">
|
||||
<code>$firstSimpleArithmeticExpression</code>
|
||||
<code>$secondSimpleArithmeticExpression</code>
|
||||
@@ -1904,11 +1910,18 @@
|
||||
</PropertyNotSetInConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="1">
|
||||
<code>$simpleArithmeticExpression</code>
|
||||
</PropertyNotSetInConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="2">
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
<code>$parser->SimpleArithmeticExpression()</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="2">
|
||||
<code>$firstSimpleArithmeticExpression</code>
|
||||
<code>$stringPrimary</code>
|
||||
@@ -1920,16 +1933,18 @@
|
||||
</PropertyNotSetInConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php">
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<PossiblyInvalidArgument occurrences="3">
|
||||
<code>$value</code>
|
||||
</PossiblyNullArgument>
|
||||
<code>$value</code>
|
||||
<code>$value</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
||||
<code>$lexer->token['value']</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PossiblyNullArrayAccess occurrences="2">
|
||||
<code>$lexer->lookahead['value']</code>
|
||||
<code>$lexer->token['value']</code>
|
||||
</PossiblyNullArrayAccess>
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="1">
|
||||
<code>$lexer->token['value']</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
<PropertyNotSetInConstructor occurrences="4">
|
||||
<code>$both</code>
|
||||
<code>$leading</code>
|
||||
@@ -2309,17 +2324,16 @@
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$lookaheadType</code>
|
||||
</InvalidArgument>
|
||||
<InvalidNullableReturnType occurrences="6">
|
||||
<InvalidNullableReturnType occurrences="1">
|
||||
<code>SelectStatement|UpdateStatement|DeleteStatement</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</InvalidNullableReturnType>
|
||||
<InvalidReturnStatement occurrences="11">
|
||||
<InvalidReturnStatement occurrences="17">
|
||||
<code>$aliasIdentVariable</code>
|
||||
<code>$factors[0]</code>
|
||||
<code>$identVariable</code>
|
||||
<code>$primary</code>
|
||||
<code>$resultVariable</code>
|
||||
<code>$resultVariable</code>
|
||||
<code>$terms[0]</code>
|
||||
<code>$this->CollectionMemberExpression()</code>
|
||||
<code>$this->ComparisonExpression()</code>
|
||||
@@ -2329,23 +2343,44 @@
|
||||
<code>$this->InstanceOfExpression()</code>
|
||||
<code>$this->LikeExpression()</code>
|
||||
<code>$this->NullComparisonExpression()</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
</InvalidReturnStatement>
|
||||
<InvalidReturnType occurrences="4">
|
||||
<InvalidReturnType occurrences="9">
|
||||
<code>AST\BetweenExpression|</code>
|
||||
<code>ArithmeticFactor</code>
|
||||
<code>ArithmeticTerm</code>
|
||||
<code>SimpleArithmeticExpression</code>
|
||||
<code>SimpleArithmeticExpression|ArithmeticTerm</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</InvalidReturnType>
|
||||
<InvalidScalarArgument occurrences="3">
|
||||
<InvalidScalarArgument occurrences="13">
|
||||
<code>$field</code>
|
||||
<code>$field</code>
|
||||
<code>$functionName</code>
|
||||
<code>$functionName</code>
|
||||
<code>$functionName</code>
|
||||
<code>$this->lexer->getLiteral($token)</code>
|
||||
<code>$this->lexer->getLiteral($token)</code>
|
||||
<code>$this->lexer->getLiteral($token)</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
</InvalidScalarArgument>
|
||||
<LessSpecificReturnStatement occurrences="3">
|
||||
<LessSpecificReturnStatement occurrences="4">
|
||||
<code>$function</code>
|
||||
<code>$function</code>
|
||||
<code>$function</code>
|
||||
<code>$token</code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MoreSpecificReturnType occurrences="1">
|
||||
<code>array{value: string, type: int|null|string, position: int}|null</code>
|
||||
</MoreSpecificReturnType>
|
||||
<NullableReturnStatement occurrences="9">
|
||||
<code>$aliasIdentVariable</code>
|
||||
<code>$factors[0]</code>
|
||||
@@ -2360,41 +2395,35 @@
|
||||
<PossiblyFalseArgument occurrences="1">
|
||||
<code>strrpos($fromClassName, '\\')</code>
|
||||
</PossiblyFalseArgument>
|
||||
<PossiblyInvalidArgument occurrences="6">
|
||||
<PossiblyInvalidArgument occurrences="14">
|
||||
<code>$AST</code>
|
||||
<code>$conditionalExpression</code>
|
||||
<code>$expr</code>
|
||||
<code>$pathExp</code>
|
||||
<code>$stringExpr</code>
|
||||
<code>$this->ConditionalExpression()</code>
|
||||
<code>$this->ConditionalExpression()</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$token['value']</code>
|
||||
<code>$token['value']</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="2">
|
||||
<PossiblyInvalidPropertyAssignmentValue occurrences="4">
|
||||
<code>$this->ConditionalExpression()</code>
|
||||
<code>$this->ConditionalExpression()</code>
|
||||
<code>$this->SimpleArithmeticExpression()</code>
|
||||
<code>$value</code>
|
||||
</PossiblyInvalidPropertyAssignmentValue>
|
||||
<PossiblyNullArgument occurrences="22">
|
||||
<PossiblyNullArgument occurrences="6">
|
||||
<code>$aliasIdentVariable</code>
|
||||
<code>$dql</code>
|
||||
<code>$field</code>
|
||||
<code>$fromClassName</code>
|
||||
<code>$functionName</code>
|
||||
<code>$functionName</code>
|
||||
<code>$functionName</code>
|
||||
<code>$resultVariable</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->lookahead['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->lexer->token['value']</code>
|
||||
<code>$this->query->getDQL()</code>
|
||||
<code>$token['value']</code>
|
||||
<code>$token['value']</code>
|
||||
<code>$token['value']</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayAccess occurrences="74">
|
||||
<code>$glimpse['type']</code>
|
||||
@@ -2472,9 +2501,6 @@
|
||||
<code>$token['value']</code>
|
||||
<code>$token['value']</code>
|
||||
</PossiblyNullArrayAccess>
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="1">
|
||||
<code>$value</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
<PossiblyNullReference occurrences="1">
|
||||
<code>getNumberOfRequiredParameters</code>
|
||||
</PossiblyNullReference>
|
||||
@@ -2507,9 +2533,9 @@
|
||||
</PropertyNotSetInConstructor>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/QueryExpressionVisitor.php">
|
||||
<RedundantCondition occurrences="1">
|
||||
<RedundantConditionGivenDocblockType occurrences="1">
|
||||
<code>Comparison::EQ</code>
|
||||
</RedundantCondition>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Query/ResultSetMapping.php">
|
||||
<PropertyTypeCoercion occurrences="3">
|
||||
@@ -3236,8 +3262,9 @@
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
<file src="lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php">
|
||||
<ArgumentTypeCoercion occurrences="1">
|
||||
<ArgumentTypeCoercion occurrences="2">
|
||||
<code>$metadata->changeTrackingPolicy</code>
|
||||
<code>$simpleXml->asXML()</code>
|
||||
</ArgumentTypeCoercion>
|
||||
<DeprecatedClass occurrences="1">
|
||||
<code>AbstractExporter</code>
|
||||
|
||||
@@ -90,18 +90,6 @@
|
||||
<file name="lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php"/>
|
||||
</errorLevel>
|
||||
</MissingDependency>
|
||||
<ParadoxicalCondition>
|
||||
<errorLevel type="suppress">
|
||||
<!-- See https://github.com/vimeo/psalm/issues/3381 -->
|
||||
<file name="lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php"/>
|
||||
</errorLevel>
|
||||
</ParadoxicalCondition>
|
||||
<NullArgument>
|
||||
<errorLevel type="suppress">
|
||||
<!-- See https://github.com/vimeo/psalm/issues/5920 -->
|
||||
<file name="lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php"/>
|
||||
</errorLevel>
|
||||
</NullArgument>
|
||||
<RedundantCastGivenDocblockType>
|
||||
<errorLevel type="suppress">
|
||||
<!-- Can be removed once the "getMaxResults" methods of those classes have native parameter types -->
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\Models\Enums;
|
||||
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Embedded;
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
|
||||
#[Entity]
|
||||
class Product
|
||||
{
|
||||
#[Id, GeneratedValue, Column(type: 'integer')]
|
||||
public int $id;
|
||||
|
||||
#[Embedded(class: Quantity::class)]
|
||||
public Quantity $quantity;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\Models\Enums;
|
||||
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Embeddable;
|
||||
|
||||
#[Embeddable]
|
||||
class Quantity
|
||||
{
|
||||
#[Column(type: 'integer')]
|
||||
public int $value;
|
||||
|
||||
#[Column(type: 'string', enumType: Unit::class)]
|
||||
public Unit $unit;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\Models\Enums;
|
||||
|
||||
enum Unit: string
|
||||
{
|
||||
case Gram = 'g';
|
||||
case Meter = 'm';
|
||||
}
|
||||
@@ -13,7 +13,7 @@ use Doctrine\ORM\Mapping\Table;
|
||||
#[Entity, Table(name: 'author')]
|
||||
class Author
|
||||
{
|
||||
#[Column, Id, GeneratedValue]
|
||||
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
|
||||
private readonly int $id;
|
||||
|
||||
#[Column]
|
||||
|
||||
@@ -17,7 +17,7 @@ use Doctrine\ORM\Mapping\Table;
|
||||
#[Entity, Table(name: 'book')]
|
||||
class Book
|
||||
{
|
||||
#[Column, Id, GeneratedValue]
|
||||
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
|
||||
private readonly int $id;
|
||||
|
||||
#[Column]
|
||||
|
||||
@@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping\Table;
|
||||
#[Entity, Table(name: 'simple_book')]
|
||||
class SimpleBook
|
||||
{
|
||||
#[Column, Id, GeneratedValue]
|
||||
#[Column, Id, GeneratedValue(strategy: 'IDENTITY')]
|
||||
private readonly int $id;
|
||||
|
||||
#[Column]
|
||||
|
||||
@@ -32,25 +32,13 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class),
|
||||
]);
|
||||
$this->createSchemaForModels(
|
||||
Phrase::class,
|
||||
PhraseType::class,
|
||||
Definition::class,
|
||||
Lemma::class,
|
||||
Type::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testIssue(): void
|
||||
|
||||
@@ -113,7 +113,6 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testBasicOneToOne(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$user = new CmsUser();
|
||||
$user->name = 'Roman';
|
||||
$user->username = 'romanb';
|
||||
@@ -658,8 +657,6 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist($article);
|
||||
$this->_em->persist($user);
|
||||
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
@@ -686,8 +683,6 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$user->username = 'gblanco';
|
||||
$user->status = 'developer';
|
||||
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$this->_em->persist($user);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
@@ -721,8 +716,6 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
});
|
||||
$this->_em->clear();
|
||||
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$userRef = $this->_em->getReference(CmsUser::class, $user->getId());
|
||||
$address2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a where a.user = :user')
|
||||
->setParameter('user', $userRef)
|
||||
|
||||
@@ -24,23 +24,9 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
|
||||
]
|
||||
$this->createSchemaForModels(
|
||||
CascadeRemoveOrderEntityO::class,
|
||||
CascadeRemoveOrderEntityG::class
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,23 +30,12 @@ class ClassTableInheritanceSecondTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(CTIParent::class),
|
||||
$this->_em->getClassMetadata(CTIChild::class),
|
||||
$this->_em->getClassMetadata(CTIRelated::class),
|
||||
$this->_em->getClassMetadata(CTIRelated2::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(CTIParent::class),
|
||||
$this->_em->getClassMetadata(CTIChild::class),
|
||||
$this->_em->getClassMetadata(CTIRelated::class),
|
||||
$this->_em->getClassMetadata(CTIRelated2::class),
|
||||
]);
|
||||
$this->createSchemaForModels(
|
||||
CTIParent::class,
|
||||
CTIChild::class,
|
||||
CTIRelated::class,
|
||||
CTIRelated2::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testOneToOneAssocToBaseTypeBidirectional(): void
|
||||
@@ -76,7 +65,6 @@ class ClassTableInheritanceSecondTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testManyToManyToCTIHierarchy(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
|
||||
$mmrel = new CTIRelated2();
|
||||
$child = new CTIChild();
|
||||
$child->setData('child');
|
||||
|
||||
@@ -23,19 +23,10 @@ class DefaultValuesTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(DefaultValueUser::class),
|
||||
$this->_em->getClassMetadata(DefaultValueAddress::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(DefaultValueUser::class),
|
||||
$this->_em->getClassMetadata(DefaultValueAddress::class),
|
||||
]);
|
||||
parent::tearDown();
|
||||
$this->createSchemaForModels(
|
||||
DefaultValueUser::class,
|
||||
DefaultValueAddress::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,12 +4,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\Models\Enums\Card;
|
||||
use Doctrine\Tests\Models\Enums\Product;
|
||||
use Doctrine\Tests\Models\Enums\Quantity;
|
||||
use Doctrine\Tests\Models\Enums\Suit;
|
||||
use Doctrine\Tests\Models\Enums\TypedCard;
|
||||
use Doctrine\Tests\Models\Enums\Unit;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
use function dirname;
|
||||
@@ -22,11 +26,11 @@ class EnumTest extends OrmFunctionalTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_em = $this->getEntityManager(null, new AttributeDriver([dirname(__DIR__, 2) . '/Models/Enums']));
|
||||
$this->_schemaTool = new SchemaTool($this->_em);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
if ($this->isSecondLevelCacheEnabled) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
@@ -101,4 +105,34 @@ EXCEPTION
|
||||
TypedCard::class => [TypedCard::class],
|
||||
];
|
||||
}
|
||||
|
||||
public function testItAllowsReadingAttributes(): void
|
||||
{
|
||||
$metadata = $this->_em->getClassMetadata(Card::class);
|
||||
$property = $metadata->getReflectionProperty('suit');
|
||||
|
||||
$attributes = $property->getAttributes();
|
||||
|
||||
$this->assertCount(1, $attributes);
|
||||
$this->assertEquals(Column::class, $attributes[0]->getName());
|
||||
}
|
||||
|
||||
public function testEnumMappingWithEmbeddable(): void
|
||||
{
|
||||
$this->setUpEntitySchema([Product::class]);
|
||||
|
||||
$product = new Product();
|
||||
$product->quantity = new Quantity();
|
||||
$product->quantity->value = 10;
|
||||
$product->quantity->unit = Unit::Gram;
|
||||
|
||||
$this->_em->persist($product);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$fetchedProduct = $this->_em->find(Product::class, $product->id);
|
||||
|
||||
$this->assertInstanceOf(Unit::class, $fetchedProduct->quantity->unit);
|
||||
$this->assertEquals(Unit::Gram, $fetchedProduct->quantity->unit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ class FlushEventTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testPersistNewEntitiesOnPreFlush(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_em->getEventManager()->addEventListener(Events::onFlush, new OnFlushListener());
|
||||
|
||||
$user = new CmsUser();
|
||||
|
||||
@@ -41,23 +41,12 @@ class LifecycleCallbackTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(LifecycleCallbackEventArgEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestUser::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackCascader::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(LifecycleCallbackEventArgEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestUser::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackCascader::class),
|
||||
]);
|
||||
parent::tearDown();
|
||||
$this->createSchemaForModels(
|
||||
LifecycleCallbackEventArgEntity::class,
|
||||
LifecycleCallbackTestEntity::class,
|
||||
LifecycleCallbackTestUser::class,
|
||||
LifecycleCallbackCascader::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testPreSavePostSaveCallbacksAreInvoked(): void
|
||||
@@ -171,8 +160,6 @@ class LifecycleCallbackTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCascadedEntitiesCallsPrePersist(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$e1 = new LifecycleCallbackTestEntity();
|
||||
$e2 = new LifecycleCallbackTestEntity();
|
||||
|
||||
|
||||
@@ -35,22 +35,12 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
|
||||
private function createSchema(): void
|
||||
{
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(OptimisticJoinedParent::class),
|
||||
$this->_em->getClassMetadata(OptimisticJoinedChild::class),
|
||||
$this->_em->getClassMetadata(OptimisticStandard::class),
|
||||
$this->_em->getClassMetadata(OptimisticTimestamp::class),
|
||||
]);
|
||||
}
|
||||
|
||||
private function dropSchema(): void
|
||||
{
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(OptimisticJoinedParent::class),
|
||||
$this->_em->getClassMetadata(OptimisticJoinedChild::class),
|
||||
$this->_em->getClassMetadata(OptimisticStandard::class),
|
||||
$this->_em->getClassMetadata(OptimisticTimestamp::class),
|
||||
]);
|
||||
$this->createSchemaForModels(
|
||||
OptimisticJoinedParent::class,
|
||||
OptimisticJoinedChild::class,
|
||||
OptimisticStandard::class,
|
||||
OptimisticTimestamp::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testJoinedChildInsertSetsInitialVersionValue(): OptimisticJoinedChild
|
||||
@@ -93,8 +83,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
} catch (OptimisticLockException $e) {
|
||||
self::assertSame($test, $e->getEntity());
|
||||
}
|
||||
|
||||
$this->dropSchema();
|
||||
}
|
||||
|
||||
public function testJoinedParentInsertSetsInitialVersionValue(): OptimisticJoinedParent
|
||||
@@ -136,8 +124,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
} catch (OptimisticLockException $e) {
|
||||
self::assertSame($test, $e->getEntity());
|
||||
}
|
||||
|
||||
$this->dropSchema();
|
||||
}
|
||||
|
||||
public function testMultipleFlushesDoIncrementalUpdates(): void
|
||||
@@ -155,8 +141,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
self::assertIsInt($test->getVersion());
|
||||
self::assertEquals($i + 1, $test->getVersion());
|
||||
}
|
||||
|
||||
$this->dropSchema();
|
||||
}
|
||||
|
||||
public function testStandardInsertSetsInitialVersionValue(): OptimisticStandard
|
||||
@@ -200,8 +184,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
} catch (OptimisticLockException $e) {
|
||||
self::assertSame($test, $e->getEntity());
|
||||
}
|
||||
|
||||
$this->dropSchema();
|
||||
}
|
||||
|
||||
public function testLockWorksWithProxy(): void
|
||||
@@ -219,7 +201,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
$this->_em->lock($proxy, LockMode::OPTIMISTIC, 1);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
$this->dropSchema();
|
||||
}
|
||||
|
||||
public function testOptimisticTimestampSetsDefaultValue(): OptimisticTimestamp
|
||||
@@ -300,8 +281,6 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
|
||||
self::assertNotNull($caughtException, 'No OptimisticLockingException was thrown');
|
||||
self::assertSame($test, $caughtException->getEntity());
|
||||
|
||||
$this->dropSchema();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
||||
|
||||
public function testEagerLoadFromInverseSideAndLazyLoadFromOwningSide(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->createLoadingFixture();
|
||||
$categories = $this->findCategories();
|
||||
$this->assertLazyLoadFromOwningSide($categories);
|
||||
@@ -87,7 +86,6 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
||||
|
||||
public function testEagerLoadFromOwningSideAndLazyLoadFromInverseSide(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->createLoadingFixture();
|
||||
$products = $this->findProducts();
|
||||
$this->assertLazyLoadFromInverseSide($products);
|
||||
|
||||
@@ -133,7 +133,6 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testLazyLoadsObjectsOnTheInverseSide2(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->createFixture();
|
||||
|
||||
$query = $this->_em->createQuery('select f,p from Doctrine\Tests\Models\ECommerce\ECommerceFeature f join f.product p');
|
||||
|
||||
@@ -15,9 +15,7 @@ use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\ORM\Mapping\OneToMany;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function count;
|
||||
use function get_class;
|
||||
@@ -30,19 +28,13 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$schemaTool = new SchemaTool($this->_em);
|
||||
try {
|
||||
$schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(Train::class),
|
||||
$this->_em->getClassMetadata(TrainDriver::class),
|
||||
$this->_em->getClassMetadata(TrainOwner::class),
|
||||
$this->_em->getClassMetadata(Waggon::class),
|
||||
$this->_em->getClassMetadata(TrainOrder::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
Train::class,
|
||||
TrainDriver::class,
|
||||
TrainOwner::class,
|
||||
Waggon::class,
|
||||
TrainOrder::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -670,6 +670,7 @@ class PaginationTest extends OrmFunctionalTestCase
|
||||
|
||||
$dql = 'SELECT p FROM Doctrine\Tests\Models\CustomType\CustomIdObjectTypeParent p';
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setMaxResults(1);
|
||||
|
||||
$paginator = new Paginator($query, true);
|
||||
$paginator->setUseOutputWalkers(false);
|
||||
|
||||
@@ -14,22 +14,16 @@ use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\ManyToMany;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(PersistentCollectionHolder::class),
|
||||
$this->_em->getClassMetadata(PersistentCollectionContent::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
PersistentCollectionHolder::class,
|
||||
PersistentCollectionContent::class
|
||||
);
|
||||
|
||||
PersistentObject::setObjectManager($this->_em);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Test that Doctrine ORM correctly works with the ObjectManagerAware and PersistentObject
|
||||
@@ -25,14 +24,7 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(PersistentEntity::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(PersistentEntity::class);
|
||||
|
||||
PersistentObject::setObjectManager($this->_em);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ use Doctrine\Tests\Models\CMS\CmsTag;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser as CmsUserProxy;
|
||||
use Exception;
|
||||
|
||||
use function assert;
|
||||
|
||||
@@ -34,20 +33,15 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(CmsUser::class),
|
||||
$this->_em->getClassMetadata(CmsTag::class),
|
||||
$this->_em->getClassMetadata(CmsPhonenumber::class),
|
||||
$this->_em->getClassMetadata(CmsArticle::class),
|
||||
$this->_em->getClassMetadata(CmsAddress::class),
|
||||
$this->_em->getClassMetadata(CmsEmail::class),
|
||||
$this->_em->getClassMetadata(CmsGroup::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
CmsUser::class,
|
||||
CmsTag::class,
|
||||
CmsPhonenumber::class,
|
||||
CmsArticle::class,
|
||||
CmsAddress::class,
|
||||
CmsEmail::class,
|
||||
CmsGroup::class
|
||||
);
|
||||
|
||||
$this->user = new CmsUser();
|
||||
$this->user->username = 'ocramius';
|
||||
|
||||
@@ -15,23 +15,7 @@ class QueryBuilderParenthesisTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(QueryBuilderParenthesisEntity::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(QueryBuilderParenthesisEntity::class),
|
||||
]
|
||||
);
|
||||
$this->createSchemaForModels(QueryBuilderParenthesisEntity::class);
|
||||
}
|
||||
|
||||
public function testParenthesisOnSingleLine(): void
|
||||
|
||||
@@ -312,8 +312,18 @@ class QueryDqlFunctionTest extends OrmFunctionalTestCase
|
||||
self::assertArrayHasKey('now', $result);
|
||||
self::assertArrayHasKey('add', $result);
|
||||
|
||||
$now = new DateTimeImmutable($result['now']);
|
||||
$inOneUnit = $now->modify(sprintf('+%d %s', $amount, $unit));
|
||||
if (
|
||||
$unit === 'month'
|
||||
&& $inOneUnit->format('m') === $now->modify('+2 month')->format('m')
|
||||
&& ! $this->_em->getConnection()->getDatabasePlatform() instanceof SqlitePlatform
|
||||
) {
|
||||
$inOneUnit = new DateTimeImmutable('last day of next month');
|
||||
}
|
||||
|
||||
self::assertEqualsWithDelta(
|
||||
(new DateTimeImmutable($result['now']))->modify(sprintf('+%d %s', $amount, $unit)),
|
||||
$inOneUnit,
|
||||
new DateTimeImmutable($result['add']),
|
||||
$delta
|
||||
);
|
||||
|
||||
@@ -522,7 +522,6 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist($article);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$q = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a where a.topic = :topic and a.user = :user')
|
||||
->setParameter('user', $this->_em->getReference(CmsUser::class, $author->id))
|
||||
->setParameter('topic', 'dr. dolittle');
|
||||
|
||||
@@ -10,7 +10,6 @@ use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function get_class;
|
||||
|
||||
@@ -25,14 +24,7 @@ class ReadOnlyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(ReadOnlyEntity::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(ReadOnlyEntity::class);
|
||||
}
|
||||
|
||||
public function testReadOnlyEntityNeverChangeTracked(): void
|
||||
|
||||
@@ -519,7 +519,6 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testToOneFilter(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->loadFixtureData();
|
||||
|
||||
$query = $this->_em->createQuery('select ux, ua from Doctrine\Tests\Models\CMS\CmsUser ux JOIN ux.address ua');
|
||||
|
||||
@@ -10,7 +10,6 @@ use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\SequenceGenerator;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Description of SequenceGeneratorTest
|
||||
@@ -25,14 +24,7 @@ class SequenceGeneratorTest extends OrmFunctionalTestCase
|
||||
self::markTestSkipped('Only working for Databases that support sequences.');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(SequenceEntity::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(SequenceEntity::class);
|
||||
}
|
||||
|
||||
public function testHighAllocationSizeSequence(): void
|
||||
|
||||
@@ -13,7 +13,6 @@ use Doctrine\ORM\Mapping\InheritanceType;
|
||||
use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @group DDC-1113
|
||||
@@ -25,17 +24,12 @@ class DDC1113Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1113Engine::class),
|
||||
$this->_em->getClassMetadata(DDC1113Vehicle::class),
|
||||
$this->_em->getClassMetadata(DDC1113Car::class),
|
||||
$this->_em->getClassMetadata(DDC1113Bus::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC1113Engine::class,
|
||||
DDC1113Vehicle::class,
|
||||
DDC1113Car::class,
|
||||
DDC1113Bus::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testIssue(): void
|
||||
|
||||
@@ -29,7 +29,6 @@ class DDC1163Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1163Product::class),
|
||||
|
||||
@@ -18,7 +18,6 @@ class DDC1193Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1193Company::class),
|
||||
|
||||
@@ -12,23 +12,17 @@ use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\JoinColumn;
|
||||
use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
class DDC1209Test extends OrmFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1209One::class),
|
||||
$this->_em->getClassMetadata(DDC1209Two::class),
|
||||
$this->_em->getClassMetadata(DDC1209Three::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC1209One::class,
|
||||
DDC1209Two::class,
|
||||
DDC1209Three::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @group DDC-1228
|
||||
@@ -21,15 +20,7 @@ class DDC1228Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1228User::class),
|
||||
$this->_em->getClassMetadata(DDC1228Profile::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC1228User::class, DDC1228Profile::class);
|
||||
}
|
||||
|
||||
public function testOneToOnePersist(): void
|
||||
|
||||
@@ -9,7 +9,6 @@ use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @group DDC-1238
|
||||
@@ -19,14 +18,7 @@ class DDC1238Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1238User::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC1238User::class);
|
||||
}
|
||||
|
||||
public function testIssue(): void
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
@@ -14,7 +15,6 @@ use Doctrine\ORM\Mapping\JoinColumn;
|
||||
use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\ORM\Mapping\OneToMany;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @group DDC-1335
|
||||
@@ -24,15 +24,10 @@ class DDC1335Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->createSchemaForModels(DDC1335User::class, DDC1335Phone::class);
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1335User::class),
|
||||
$this->_em->getClassMetadata(DDC1335Phone::class),
|
||||
]
|
||||
);
|
||||
$this->loadFixture();
|
||||
} catch (Exception $e) {
|
||||
} catch (UniqueConstraintViolationException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function get_class;
|
||||
|
||||
@@ -25,15 +24,10 @@ class DDC1461Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1461TwitterAccount::class),
|
||||
$this->_em->getClassMetadata(DDC1461User::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC1461TwitterAccount::class,
|
||||
DDC1461User::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testChangeDetectionDeferredExplicit(): void
|
||||
|
||||
@@ -16,7 +16,6 @@ use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\ORM\Mapping\OneToMany;
|
||||
use Doctrine\ORM\Mapping\PostLoad;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function get_class;
|
||||
use function get_debug_type;
|
||||
@@ -32,16 +31,11 @@ class DDC1655Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1655Foo::class),
|
||||
$this->_em->getClassMetadata(DDC1655Bar::class),
|
||||
$this->_em->getClassMetadata(DDC1655Baz::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC1655Foo::class,
|
||||
DDC1655Bar::class,
|
||||
DDC1655Baz::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testPostLoadOneToManyInheritance(): void
|
||||
|
||||
@@ -38,8 +38,6 @@ class DDC168Test extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testJoinedSubclassPersisterRequiresSpecificOrderOfMetadataReflFieldsArray(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$spouse = new CompanyEmployee();
|
||||
$spouse->setName('Blub');
|
||||
$spouse->setDepartment('Accounting');
|
||||
|
||||
@@ -20,22 +20,7 @@ class DDC1719Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1719SimpleEntity::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC1719SimpleEntity::class),
|
||||
]
|
||||
);
|
||||
$this->createSchemaForModels(DDC1719SimpleEntity::class);
|
||||
}
|
||||
|
||||
public function testCreateRetrieveUpdateDelete(): void
|
||||
|
||||
@@ -31,8 +31,6 @@ class DDC211Test extends OrmFunctionalTestCase
|
||||
|
||||
public function testIssue(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$user = new DDC211User();
|
||||
$user->setName('John Doe');
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ class DDC258Test extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testIssue(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$c1 = new DDC258Class1();
|
||||
$c1->title = 'Foo';
|
||||
$c1->description = 'Foo';
|
||||
|
||||
@@ -29,32 +29,16 @@ class DDC2602Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC2602User::class),
|
||||
$this->_em->getClassMetadata(DDC2602Biography::class),
|
||||
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
||||
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
||||
]
|
||||
$this->createSchemaForModels(
|
||||
DDC2602User::class,
|
||||
DDC2602Biography::class,
|
||||
DDC2602BiographyField::class,
|
||||
DDC2602BiographyFieldChoice::class
|
||||
);
|
||||
|
||||
$this->loadFixture();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC2602User::class),
|
||||
$this->_em->getClassMetadata(DDC2602Biography::class),
|
||||
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
||||
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function testPostLoadListenerShouldBeAbleToRunQueries(): void
|
||||
{
|
||||
$eventManager = $this->_em->getEventManager();
|
||||
|
||||
@@ -14,7 +14,6 @@ use Doctrine\ORM\Mapping\MappedSuperclass;
|
||||
use Doctrine\ORM\Mapping\PrePersist;
|
||||
use Doctrine\ORM\Mapping\PreUpdate;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function assert;
|
||||
use function get_class;
|
||||
@@ -24,14 +23,7 @@ class DDC2895Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC2895::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC2895::class);
|
||||
}
|
||||
|
||||
public function testPostLoadOneToManyInheritance(): void
|
||||
|
||||
@@ -17,24 +17,7 @@ class DDC309Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC309Country::class),
|
||||
$this->_em->getClassMetadata(DDC309User::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC309Country::class),
|
||||
$this->_em->getClassMetadata(DDC309User::class),
|
||||
]
|
||||
);
|
||||
|
||||
parent::tearDown();
|
||||
$this->createSchemaForModels(DDC309Country::class, DDC309User::class);
|
||||
}
|
||||
|
||||
public function testTwoIterateHydrations(): void
|
||||
|
||||
@@ -26,7 +26,6 @@ class DDC345Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC345User::class),
|
||||
|
||||
@@ -25,7 +25,6 @@ class DDC371Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC371Parent::class),
|
||||
|
||||
@@ -18,7 +18,6 @@ use Doctrine\ORM\Mapping\JoinTable;
|
||||
use Doctrine\ORM\Mapping\ManyToMany;
|
||||
use Doctrine\ORM\Mapping\Table;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
class DDC3785Test extends OrmFunctionalTestCase
|
||||
{
|
||||
@@ -28,16 +27,11 @@ class DDC3785Test extends OrmFunctionalTestCase
|
||||
|
||||
Type::addType('ddc3785_asset_id', DDC3785AssetIdType::class);
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC3785Asset::class),
|
||||
$this->_em->getClassMetadata(DDC3785AssetId::class),
|
||||
$this->_em->getClassMetadata(DDC3785Attribute::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC3785Asset::class,
|
||||
DDC3785AssetId::class,
|
||||
DDC3785Attribute::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@ use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function serialize;
|
||||
use function unserialize;
|
||||
@@ -20,14 +19,7 @@ class DDC381Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC381Entity::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC381Entity::class);
|
||||
}
|
||||
|
||||
public function testCallUnserializedProxyMethods(): void
|
||||
|
||||
@@ -26,7 +26,6 @@ class DDC422Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC422Guest::class),
|
||||
|
||||
@@ -29,8 +29,6 @@ class DDC425Test extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testIssue(): void
|
||||
{
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$num = $this->_em->createQuery('DELETE ' . __NAMESPACE__ . '\DDC425Entity e WHERE e.someDatetimeField > ?1')
|
||||
->setParameter(1, new DateTime(), Types::DATETIME_MUTABLE)
|
||||
->getResult();
|
||||
|
||||
@@ -19,7 +19,6 @@ class DDC444Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC444User::class),
|
||||
|
||||
@@ -12,7 +12,6 @@ use Doctrine\ORM\Mapping\JoinColumn;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function get_class;
|
||||
|
||||
@@ -26,16 +25,11 @@ class DDC522Test extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC522Customer::class),
|
||||
$this->_em->getClassMetadata(DDC522Cart::class),
|
||||
$this->_em->getClassMetadata(DDC522ForeignKeyTest::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC522Customer::class,
|
||||
DDC522Cart::class,
|
||||
DDC522ForeignKeyTest::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,14 +32,7 @@ class DDC5684Test extends OrmFunctionalTestCase
|
||||
DBALTypes\Type::addType(DDC5684ObjectIdType::class, DDC5684ObjectIdType::class);
|
||||
}
|
||||
|
||||
$this->_schemaTool->createSchema([$this->_em->getClassMetadata(DDC5684Object::class)]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->_schemaTool->dropSchema([$this->_em->getClassMetadata(DDC5684Object::class)]);
|
||||
|
||||
parent::tearDown();
|
||||
$this->createSchemaForModels(DDC5684Object::class);
|
||||
}
|
||||
|
||||
public function testAutoIncrementIdWithCustomType(): void
|
||||
|
||||
@@ -24,7 +24,6 @@ class DDC599Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
@@ -14,7 +15,6 @@ use Doctrine\ORM\Mapping\ManyToOne;
|
||||
use Doctrine\ORM\Mapping\OneToMany;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @group DDC-618
|
||||
@@ -24,14 +24,9 @@ class DDC618Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC618Author::class),
|
||||
$this->_em->getClassMetadata(DDC618Book::class),
|
||||
]
|
||||
);
|
||||
$this->createSchemaForModels(DDC618Author::class, DDC618Book::class);
|
||||
|
||||
try {
|
||||
// Create author 10/Joe with two books 22/JoeA and 20/JoeB
|
||||
$author = new DDC618Author();
|
||||
$author->id = 10;
|
||||
@@ -50,7 +45,7 @@ class DDC618Test extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
} catch (Exception $e) {
|
||||
} catch (UniqueConstraintViolationException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,22 +11,16 @@ use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\ORM\Mapping\OneToOne;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
class DDC633Test extends OrmFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC633Patient::class),
|
||||
$this->_em->getClassMetadata(DDC633Appointment::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(
|
||||
DDC633Patient::class,
|
||||
DDC633Appointment::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@ use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function array_keys;
|
||||
use function get_class;
|
||||
@@ -19,14 +18,7 @@ class DDC656Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC656Entity::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC656Entity::class);
|
||||
}
|
||||
|
||||
public function testRecomputeSingleEntityChangeSetPreservesFieldOrder(): void
|
||||
|
||||
@@ -14,7 +14,6 @@ use Doctrine\ORM\Mapping\JoinTable;
|
||||
use Doctrine\ORM\Mapping\ManyToMany;
|
||||
use Doctrine\ORM\Mapping\Table;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function strtolower;
|
||||
|
||||
@@ -23,15 +22,7 @@ class DDC698Test extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(DDC698Role::class),
|
||||
$this->_em->getClassMetadata(DDC698Privilege::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->createSchemaForModels(DDC698Role::class, DDC698Privilege::class);
|
||||
}
|
||||
|
||||
public function testTicket(): void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user