profile
viewpoint
Benjamin Eberlei beberlei Tideways GmbH @tidewaysio Germany https://beberlei.de Founder of @tideways, PHP performance monitoring, profiling and exception tracking software. @doctrine core member and occasional @php contributor

beberlei/assert 2047

Thin assertion library for use in libraries and business-model

beberlei/DoctrineExtensions 1566

A set of Doctrine 2 extensions

beberlei/composer-monorepo-plugin 262

Integrates Composer into monolithic repositories with many packages.

beberlei/AcmePizzaBundle 136

Acme Form Experimental Bundle

beberlei/bankaccount 43

Sample application used for PHPUnit training.

beberlei/Doctrine-Workflow 33

A Doctrine 2 persistence layer for ezcWorkflow

beberlei/DoctrineCodeGenerator 31

Prototype of an AST based Event Driven CodeGenerator

beberlei/Doctrine-ActiveEntity 25

ActiveRecord ORM (Mod) on top of Doctrine2

beberlei/azure-blob-storage 21

Small platform-independent library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.

beberlei/context 15

DEPRECATED

Pull request review commentphp/php-src

Promote warnings to error in DOM ext

 int dom_node_node_name_read(dom_object *obj, zval *retval) 			str = "#text"; 			break; 		default:-			php_error_docref(NULL, E_WARNING, "Invalid Node Type");+			zend_value_error("XML Node type must be one of XML_*_NODE");

all node types are handled here, this should only fail if libxml adds something new, which is highly unlikely. The user would not be able to address this error as its a C programming error not a PHP one, so the message could better be "Unknown node type in libxml datastructure that DOM extension cannot handle." - I don't expect it to be ever seen by anyone

Girgias

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

issue openedpheanstalk/pheanstalk

Timeout is a float in fsockopen, wrongly set in Pheanstalk, Socket

https://www.php.net/manual/en/function.fsockopen.php defines timeout as a float, however Pheanstalk defines it as an integer. That prevents setting it to values such as 0.1 or 0.2 to get sub-second connection timeouts on infrastructures where Beanstlak server is close to the application server.

created time in 3 days

issue closeddoctrine/dbal

Cockroach Compatibility / dbal

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

I am wondering if there is / will be an effort to support the rest of the CockroachDB internals with Doctrine? The wire protocol for Cockroach is supported by pdo_pgsql however many of the internals of the driver are broken, including

  • differently named functions for generating uuid s
  • internal schema differences in things like the sequences:
In AbstractPostgreSQLDriver.php line 60:

  An exception occurred while executing 'SELECT min_value, increment_by FROM "ledger_entries_id_seq"':

  SQLSTATE[42703]: Undefined column: 7 ERROR:  column "min_value" does not exist

actual structure is similar in Cockroach:

SELECT * FROM "whatever_id_seq";
 last_value | log_cnt | is_called
------------+---------+-----------
          0 |       0 | t
(1 Zeile)
  • different internal column types: https://github.com/cockroachdb/cockroach/issues/19337

and probably more.

In my (amateur) estimation this could be covered by adding a logic in a new \Doctrine\DBAL\Driver\PDOPgSql\Connection class which detects the difference between an underlying Cockroach DB and a PostgresSQL db and returns an appropriate platform.

Is anyone aware of any forks or similar attempts to bridge this compatibility gap? I would also be willing to help!

Many thanks in advance!

Tyler

closed time in 5 days

tdashton

issue commentdoctrine/dbal

Cockroach Compatibility / dbal

I agree with @morozov here, you can provide a Cockroach DB platform in the factory of DBAL and provide it as a third party package. Doctrine itself is not going to support this in the near or mid-term future.

tdashton

comment created time in 5 days

pull request commentdoctrine/dbal

Revert Exception Class renames

@morozov The only argument that counts is that its a convention across all Doctrine projects that a base exception exists that has the name of the component. We haven't changed this convention even though the coding standard was defined in defiance of it.

In addition to that argument, the deprecation seems the smallest, but is actually very nasty, because a catch (DBALException $e) does not trigger the autoloader, as such no deprecation can be triggered. only when the excepiton is actually triggered can we do that. Since that means the code is not running in the happy path, its much more likely that you oversee this while migrating from DBAL 2 to 3.

Most of the other deprecations are either in the factory related code, or directly in execution and fetching. Honestly I don't think we should deprecate those either, we could keep them and just not document them, but it will be much more obvious to users to see once we trigger the deprecations.

beberlei

comment created time in 5 days

PullRequestReviewEvent

issue commentdoctrine/orm

[Feature] Optimizing column alignment

There is a big fat warning about it in the documentation as the first sentence about explaining SchemaTool: https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/tools.html#database-schema-generation

flaushi

comment created time in 8 days

issue closeddoctrine/orm

[Feature] Optimizing column alignment

Dear community,

I just stumbled over this article https://www.2ndquadrant.com/en/blog/on-rocks-and-sand/ where the benefits of an optimized column alignment are discussed.

I never thought about this before "because doctrine does all this for me". But is this true? When creating the sql statements to create the schema, is the column order optimized?

The rule of thumb to take large columns first looks like doctrine could implement this easily...?

closed time in 8 days

flaushi

issue commentdoctrine/orm

[Feature] Optimizing column alignment

@flaushi This is outside of Doctrine's scope. We do not recommend to use the SchemaTool directly on production / deployment anyways, you are free to optimize the generated DDL SQL statements in a way that reduces the required table space by aligning columns better.

flaushi

comment created time in 8 days

delete branch beberlei/php-src

delete branch : ErrorNotifyObserverRename

delete time in 11 days

PR closed php/php-src

Rename zend_error_notify APIs to zend_observer_error*

My previous PR #4555 introduced a new error notification callback API. After merging #5857 for PHP 8 as well, this PR moves the error notification API into zend_observer.h and zend_observer.c.

This will produce a more consistent naming for future, where we provide a general observer API into different parts of PHP engine.

A soft goal would be that we can replace all parts of Dtrace support that are currently hardcoded into the engine using this general observer API provided by zend_observer.h at some point in the future, so that dtrace can become an extension instead of being coupled into the engine.

/cc @morrisonlevi @SammyK

+34 -49

1 comment

7 changed files

beberlei

pr closed time in 11 days

pull request commentphp/php-src

Rename zend_error_notify APIs to zend_observer_error*

Merged in https://github.com/php/php-src/commit/1359a52d5bbab26004c6195d9d8b8fbc720fd701

beberlei

comment created time in 11 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 64ebece1fccbf42fedd2ab5899e233303201e367

Undeprecate \Doctrine\DBAL\Driver\DriverException interface

view details

push time in 11 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 8510571a869dafe0590672155f2e4afc2676ea2b

Housekeeping fixes

view details

push time in 11 days

push eventbeberlei/dbal

Igor Scheller

commit sha 7570aeb83efb7efda1714436fe1af5cb9baaaa5d

SQLite: Fix wrongly detected reference constraint name on schema change If there is no constraint name defined the listTableForeignKeys should not invent a new one as a numerical id has no deeper meaning and makes schema changes adding information that was not there before. Using `null` is an apropriate value as its already in use when handling not existing fk names.

view details

Grégoire Paris

commit sha cd2dddaa39a291086a8a88faece6629622192618

Merge pull request #4246 from MyIgel/patch-1 SQLite: Fix wrongly detected reference constraint name on schema change

view details

Grégoire Paris

commit sha 16d5861f70e5c4f4c62f32c6ab89bb66cd3f34a9

Reuse global coding standard workflow This is part of an effort to standardize workflows accross repositories. We do not have a way to do it automatically yet, but it is still nice to have one reference repository.

view details

Grégoire Paris

commit sha f392ffc2b60f2618ddfd03d14fb299e6e49604e9

Merge pull request #4252 from greg0ire/sync-phpcs-workflow Reuse global coding standard workflow

view details

Sergei Morozov

commit sha 34f3ceddf01e6030dd5332928409020309bc7187

Handle both ways of PDO reporting failed connection

view details

Sergei Morozov

commit sha fdbd770bd8a4d253639d1bcfda73b5dc2da8748a

Merge pull request #4268 from morozov/issues/4267 Handle both ways of PDO reporting failed connection

view details

Sergei Morozov

commit sha 3caa55c72abec675aa15cdf01de261be7cb58043

Revert "Use proper check in acceptForeignKey()" This reverts commit f0c1af4b1a08076fdd2e4c7ec22c0b805e246e0e.

view details

Sergei Morozov

commit sha baec4b8ea8aabe7b9c58b403d706465c897f4be9

Revert "Add full support for foreign key constraints for SQLite" This reverts commit 85a983c3f8d6447c4441832477def1c28d57bee9.

view details

Sergei Morozov

commit sha 912db7a28be30512a8dc631e06e5be3fb7906a37

Revert "SQLite: Fix wrongly detected reference constraint name on schema change" This reverts commit 7570aeb83efb7efda1714436fe1af5cb9baaaa5d.

view details

Sergei Morozov

commit sha 03bc93b79cd58bbccc22bc31caf2df4831c965d1

Merge pull request #4255 from morozov/issues/4243 Revert full support for foreign key constraints for SQLite

view details

Sergei Morozov

commit sha 76c4c33e0a086dd38c134bab0c6169bb19d86d1c

Merge branch '2.10.x' into 2.11.x

view details

Grégoire Paris

commit sha d333f7c0e0f5eacdf3baa903b1c18badcd49c9fc

Setup automatic release workflow

view details

Grégoire Paris

commit sha cce615a9e4b21d4dbbf3553aae1f597b810a8c95

Merge pull request #4251 from doctrine/greg0ire-patch-1 Setup automatic release workflow

view details

Benjamin Eberlei

commit sha 3691e814f58aada2a8c5901b00ddaca5c2801e33

Revert "Merge pull request #4253 from morozov/deprecate-dbal-exception" This reverts commit f97ee9445186e2f5edd519579405df53521cdae4, reversing changes made to f69c990e359931753232a81c3a1821a7ea060bfd.

view details

Benjamin Eberlei

commit sha 17a224292644745dd9fe7263001a64941584887c

UNdeprecate DriverException interface

view details

Benjamin Eberlei

commit sha d8bacfa9fda4179c1a5af2181f9eea8490d36acc

Disambigouate DriverException interface from Exception\DriverExceptoin through introduction of LowLevelDriverException interface.

view details

Benjamin Eberlei

commit sha f6c2ac52df8081755957e54784996999f09ede9a

Address php-stan violatoins with Exception type-hints.

view details

Benjamin Eberlei

commit sha c4aa957b35b9b714cccc0a7059e38af9e2d3887e

Address Psalm violation

view details

Benjamin Eberlei

commit sha 12f08cb09d0c22b71822ed714f54657344537fbe

Fix phpcs violations

view details

Benjamin Eberlei

commit sha 3ac7eb2f39dcba9ac58d0bb3c21203a4c0eae2a2

Bugfix: Checked for wrong exception

view details

push time in 11 days

Pull request review commentdoctrine/dbal

Revert Exception Class renames

 The non-interface methods of driver-level classes have been marked internal: - `OCI8Connection::getExecuteMode()` - `OCI8Statement::convertPositionalToNamedPlaceholders()` -## Deprecated `DBALException`--The `Doctrine\DBAL\DBALException` class has been deprecated in favor of `Doctrine\DBAL\Exception`.- ## Inconsistently and ambiguously named driver-level classes are deprecated  The following classes under the `Driver` namespace have been deprecated in favor of their consistently named counterparts: -- `DriverException` → `Exception`+- `DriverException` → `LowLevelDriverException`

Reverted to using Driver\DriverException including the alisases in DBALException and Exception\DriverException.

beberlei

comment created time in 11 days

PullRequestReviewEvent

push eventbeberlei/dbal

Benjamin Eberlei

commit sha e4b58e29f797645c15f0e225bd6720e488dc2cee

Remove wrong @throws DBALEception in tests.

view details

push time in 11 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 947b28aa6c903e85a3984cc4a455b5d5605d108d

Keep Driver\DriverException

view details

push time in 11 days

push eventbeberlei/php-src

Benjamin Eberlei

commit sha f3211f38f410c08f37e44e85e3f050793029fb1f

Merge zend_observer_error_startup/shutdown into zend_observer_startup/shutdown

view details

push time in 11 days

push eventbeberlei/php-src

Benjamin Eberlei

commit sha 179dcc0e5a552ffd467bd226f70d85e3f7131224

Missing include

view details

push time in 11 days

PR opened php/php-src

Rename zend_error_notify APIs to zend_observer_error*

My previous PR #4555 introduced a new error notification callback API. After merging #5857 for PHP 8 as well, this PR moves the error notification API into zend_observer.h and zend_observer.c.

This will produce a more consistent naming for future, where we provide a general observer API into different parts of PHP engine.

A soft goal would be that we can replace all parts of Dtrace support that are currently hardcoded into the engine using this general observer API provided by zend_observer.h, so that dtrace can become an extension instead of being coupled into the engine.

/cc @morrisonlevi @SammyK

+45 -49

0 comment

7 changed files

pr created time in 11 days

create barnchbeberlei/php-src

branch : ErrorNotifyObserverRename

created branch time in 11 days

issue openedgyro-project/mvc-bundle

Add EventDispatcher adapter

EventDispatcher::dispatch API changed between Symfony 3 and 4 and should maybe get streamlined with an adapter.

created time in 11 days

PullRequestReviewEvent

pull request commentphp/php-src

[Observer] Fatal error support

@nikic Yes it should be, zend_error_impl is called regardless of being "in soap" or not for errors/warnings/... when they occur, this happens outside the php_error_cb which can be replaced, its placed near the error notify callback code, which was also built to always trigger.

SammyK

comment created time in 11 days

PR closed php/php-src

Remove @jit Docblock support for now due to dev-time constraints

@dstogov @nikic I think tihs should get in before RC1 on Tuesday, what do you think?

That gives us time to discuss for 8.1 how to do it with attributes, it seems we would benefit from first results from users to see how we can give them more control.

+2 -53

2 comments

1 changed file

beberlei

pr closed time in 11 days

pull request commentphp/php-src

Remove @jit Docblock support for now due to dev-time constraints

Merged in https://github.com/php/php-src/commit/ff0e39bb4dbe542f8795dfa1fef491cd3d30aae3

beberlei

comment created time in 11 days

Pull request review commentdoctrine/dbal

Revert Exception Class renames

 public function testModifyLimitQueryWithComplexOrderByExpression(): void         self::assertEquals($sql, $expected);     } +    /**+     * @throws DBALException

I believe this is from the revert commit, I didn't change this myself.

beberlei

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentdoctrine/dbal

Revert Exception Class renames

 The non-interface methods of driver-level classes have been marked internal: - `OCI8Connection::getExecuteMode()` - `OCI8Statement::convertPositionalToNamedPlaceholders()` -## Deprecated `DBALException`--The `Doctrine\DBAL\DBALException` class has been deprecated in favor of `Doctrine\DBAL\Exception`.- ## Inconsistently and ambiguously named driver-level classes are deprecated  The following classes under the `Driver` namespace have been deprecated in favor of their consistently named counterparts: -- `DriverException` → `Exception`+- `DriverException` → `LowLevelDriverException`

I am not happy with it myself, the existence of DriverException in both Exception and Driver namespaces is a bit confusing, and its annoying that an alias is necessary.

beberlei

comment created time in 12 days

PullRequestReviewEvent

issue commentdoctrine/orm

MATCH Query : Access array offset on value of type null in DQL parser

@greg0ire this sounds a lot like that bug we had early in 2.7 cycle, do you remember what it was?

aguidis

comment created time in 12 days

issue closeddoctrine/orm

EntityRepository::findOneBy() should throw NonUniqueResultException

I have just read that a Query throws a NonUniqueResultException if Query::getOneOrNullResult() or Query::getSingleResult() is called and finds more than one matching result.

Do you think it is feasible? And if not, why?

closed time in 12 days

KouloukLeGrand

issue commentdoctrine/orm

EntityRepository::findOneBy() should throw NonUniqueResultException

That is the way we want the API to work, multiple results can lead to the risk of the wrong one being picked without developer noticing.

KouloukLeGrand

comment created time in 12 days

issue closeddoctrine/orm

Foreign key referencing a Uuid id with custom type with the same length

I'm defining

a Cart entity

    <entity name="Model\Cart" table="cart">
        <id name="id" type="uuid" length="36"/>
        <one-to-many field="items" target-entity="Model\CartItem"  mapped-by="cart">
            <cascade>
                <cascade-persist/>
            </cascade>
        </one-to-many>
    </entity>

and CartItem entity

    <entity name="Model\CartItem" table="cart_item">
        <id name="id" type="uuid" length="36"/>
        <many-to-one field="cart" target-entity="Model\Cart" inversed-by="items">
            <join-column name="cart_id" column-definition="" referenced-column-name="id" on-delete="CASCADE"/>
        </many-to-one>
      </entity>

Where uuid id is a Custom Type

This Doctrine translate to (I edited the real entities and sql to minimize the code)

CREATE TABLE cart (
id VARCHAR(36) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`,
 PRIMARY KEY(id))

and

CREATE TABLE cart_item (
id VARCHAR(36) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`,
 cart_id VARCHAR(255) CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`,
 INDEX IDX_F0FE25271AD5CDBF (cart_id),
 PRIMARY KEY(id))

I don't know why generates in CartItem: cart_id VARCHAR(255) If in Cart is: id VARCHAR(36)

And what can I add/changein mapping to the set correct length of the cart_id FK column ?

I add the custom type for more details:

<?php

class UuidType extends StringType
{
    private const LENGTH = 36;

    public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        return empty($value) ? $value : new UuidValueObject($value);
    }

    public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        return empty($value) ? $value : (string)$value;
    }

    public function requiresSQLCommentHint(AbstractPlatform $platform)
    {
        return true;
    }

    public function getDefaultLength(AbstractPlatform $platform)
    {
        return self::LENGTH;
    }
}

closed time in 12 days

ferriol

issue commentdoctrine/orm

Foreign key referencing a Uuid id with custom type with the same length

You need to set the column-definition="VARCHAR(36)" in the join-column. This information is not inherited from the primary key.

ferriol

comment created time in 12 days

issue closeddoctrine/orm

Deferred Explicit change tracking policy + removal + persist of objects leads to not-persisted changes

... That's hard to describe, I'll try nevertheless :-)

Background

  • We use Deferred Explicit as change tracking policy; and we have a single entity which is enough to reproduce the issue.
  • The entity is persisted in the database already, and we have loaded it as $entity.

How to reproduce

  • call $entityManager->remove($entity);
  • modify the entity $entity->setFoo('bar');
  • call $entityManager->persist($entity);
  • call $entityManager->flush();
  • EXPECTED: The entity should be updated in the database.
  • ACTUAL: the entity is not updated.

Root Cause Analysis:

  • call $entityManager->remove($entity);
  • modify the entity $entity->setFoo('bar');
  • call $entityManager->persist($entity);
  • call $entityManager->flush();
  • EXPECTED: The entity should be updated in the database.
  • ACTUAL: the entity is not updated.

closed time in 12 days

skurfuerst

issue commentdoctrine/orm

Lost Update when using Deferred Explicit change tracking, Remove followed by Persist.

@skurfuerst Valid report, please make it a pull request against the 2.7 branch.

skurfuerst

comment created time in 12 days

issue closeddoctrine/orm

Error: The annotation does not exist

I created a project, where the entities have annotations from both Doctrine\ORM\Mapping and MyLib\Annotation, like this:

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MyLib\Annotation as MA;

/**
 * @ORM\Entity
 * @ORM\Table(name="users")
 */
class User
{

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     * @MA\Example
     */
    public $id;

    /**
     * @ORM\Column(type="string")
     */
    public $name;

}

Unfortunately I get this error, if I try to run orm:schema-tool:update:

In AnnotationException.php line 54:

  [Semantical Error] The annotation "@MyLib\Annotation\Example" in property App\Entity\User::$id does not exist,
   or could not be auto-loaded.

I created a minimal reproducible example project, it can be found here: https://github.com/ad-test/doctrine-annotation-bug

closed time in 12 days

ad-test

issue closeddoctrine/orm

Is it still necessary to wrap the __clone implementation in an if check?

The documentation says that __clone (and __wakeup) are not save to implement without an id check. But the Instantiator has an isSafeToClone method that checks if there is an __clone method implemented. So is it still necessary to wrap the __clone into the id check?

Thanks!

closed time in 12 days

sirdiego

issue commentdoctrine/orm

Is it still necessary to wrap the __clone implementation in an if check?

@sirdiego No, its not necessary anymore, that was before ReflectionClass::newInstanceWithoutConstructor was added in PHP 5.4 or 5.5

sirdiego

comment created time in 12 days

issue closeddoctrine/orm

Schema update does not add column to the right place nor reorder them

Step to reproduce:

  1. create model like:
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 **/
class Record {
    /**
     * @var int
     * @ORM\Id
     * @ORM\Column(name="id", type="bigint", options={"unsigned"=true})
     **/
    public $id;

    /** @var \DateTime @ORM\Column(type="datetime_immutable") */
    public $createdAt;
}
  1. create DB, ie. run
vendor\doctrine\orm\bin\doctrine.php orm:schema-tool:update --dump-sql --complete --force
  1. then update the model by appending this right below the ID column:
    /** @var string @ORM\Column(type="string", length=500) */
    public $name;
  1. update the DB, ie. run:
vendor\doctrine\orm\bin\doctrine.php orm:schema-tool:update --dump-sql --complete --force
  1. notice, that the column was added at the end of the table, instead of using AFTER (see https://dev.mysql.com/doc/refman/5.7/en/alter-table.html#alter-table-redefine-column) in the update command (in step 4)

I belive this needs to be addressed in the Doctrine\DBAL\Schema\Comparator as it is used for diffing the schema in: https://github.com/doctrine/orm/blob/ccae8f717684dcd871b418444d7ca7155c677169/lib/Doctrine/ORM/Tools/SchemaTool.php#L906

closed time in 12 days

mvorisek

issue commentdoctrine/orm

Schema update does not add column to the right place nor reorder them

This is a cosmetic thing that you can add yourself if you want to, but its not something that we are going to add to Doctrine DBAL Schema support.

mvorisek

comment created time in 12 days

issue closeddoctrine/orm

Accessing Many-To-Many Relation in child entity through parent using CTI

Hi,

I'm trying to load ManyToMany associations on child entities using the parent entity. Here is an example to try to make this clearer:

I have a parent abstract Entity. Let's call it Animal. Then I have two entities inheriting Animal called Dog and Cat. Dog has a ManyToMany relation with DogHouse and Cat a ManyToMany relation with LitterBox. The inheritance type is a CTI

Now when I load all the Animal I want to fetch at the same time DogHouse and LitterBox to avoid several queries when accessing those entities

I've tried a bunch of ways and it either throws errors as DogHouse and LitterBox do not have a relation with Animal or the hydration breaks and instead of a collection of Animal entities I end up with a collection of Animal, DogHouse and LitterBox

I've searched for ages on the Web and haven't found my answer, sadly

Here are examples of the requests I tried :

//In a repository
// Doesn't work as animal doesn't have a relation with doghouse
$this->createQueryBuilder("a")
    ->leftJoin("a.doghouses", "dh")
    ->addSelect("dh");


//In a repository
//Returns a collection of Animals and DogHouses instead of just Animals
$this->createQueryBuilder("a")
    ->leftJoin(DogHouse::class, "dh", "WITH", "a MEMBER OF dg.dogs")
    ->addSelect("dh");

//In a repository
//Doesn't work either as you now have duplicates in your collection between Animal and Dog
$this->createQueryBuilder("a")
    ->leftJoin(Dog::class, "d", "WITH", "d.id = a.id")
    ->addSelect('d')
    ->leftJoin("d.doghouses", "dh")
    ->addSelect("dh");

I don't know if this is possible through DQL/QueryBuilder

Thanks in advance for your help

closed time in 12 days

Thewolfs

issue commentdoctrine/orm

Accessing Many-To-Many Relation in child entity through parent using CTI

This is not possible, because inheritance rules are enforced in DQL as they would be in PHP. You can convert it to a native SQL query or rethink your use of inheritance, it looks like it might not be a good fit.

Thewolfs

comment created time in 12 days

PR opened php/php-src

Remove @jit Docblock support for now due to dev-time constraints

@dstogov @nikic I think tihs should get in before RC1 on Tuesday, what do you think?

That gives us time to discuss for 8.1 how to do it with attributes, it seems we would benefit from first results from users to see how we can give them more control.

+2 -53

0 comment

1 changed file

pr created time in 12 days

create barnchbeberlei/php-src

branch : RemoveJitDocblockSupport

created branch time in 12 days

PullRequestReviewEvent

Pull request review commentdoctrine/persistence

Import useful reflection classes

+<?php++namespace Doctrine\Persistence\Reflection;++use Doctrine\Common\Proxy\Proxy;

The other option is to copy the interface here and add a autoload-dev. Since its just a marker interface with no methods, there is no risk of breaking with or without doctrine/common.

greg0ire

comment created time in 12 days

PullRequestReviewEvent

PR opened doctrine/orm

[GH-8265] Prototype for Attribute Metadata Driver

Draft for #8265

As you can see in AttributeReader, we cannot use ReflectionAttribute::newInstance because of how Doctrine Annotations implements named parameters at the moment. Two ways forward:

  1. Copy all Doctrine\ORM\Mapping annotation classes to a new namespace and make them use constructor property promotion.
  2. release a new version of doctrine/annotations so that we align named argument supports with how PHP 8 does it, so that all classes in Doctrine\ORM\Mapping can introduce a constructor for 2.8

A constructor for each Attribute (annotation) class is needed so that IDEs can typehint them and ReflectionAttribute::newInstance can be used instead of a custom factory approach.

Todos:

  • [ ] Actually run this against a php 8 build
  • [ ] Adjust tests to make this running
+794 -0

0 comment

40 changed files

pr created time in 12 days

create barnchbeberlei/doctrine2

branch : GH-8265-AttributeDriver

created branch time in 12 days

issue commentdoctrine/orm

Add New Attribute Metadata Driver

The problem without this change is that we could not use ReflectionAttribute::newInstance then and also would probably confuse IDE autocomplete for attributes as they look for constructor arguments to suggest.

beberlei

comment created time in 12 days

issue commentdoctrine/orm

Add New Attribute Metadata Driver

Currently Annotation DocParser does new $annotation($values); if a constructor is detected. This is based on the Annotation base class that existis in the library. We should have another use-case where it checks for constructor but not extending Doctrine\Common\Annotations\Nnnotation and in that case replicate named arguments behavior: @Column(name="foo") maps to a constructor __construct($name).

This is required so we can move all annotation classes to use a constructor in ORM 2.8.

beberlei

comment created time in 12 days

issue commentdoctrine/orm

Add New Attribute Metadata Driver

@lcobucci not for a new metadata driver

beberlei

comment created time in 12 days

issue commentdoctrine/orm

Add New Attribute Metadata Driver

Problem with this approach is that without a constructor using parameters, IDEs will probably not autocomplete the named properties of attributes. This requires us to duplicate all attribute classes unless we find some clever magic, or adjust the Annotation DocParser case with has_constructor must be changed or broken in some way.

beberlei

comment created time in 12 days

issue openeddoctrine/orm

Add New Attribute Metadata Driver

For Doctrine ORM 2.8 we should add a metadata driver using Attributes, based off the AnnotationDriver with some adjustment to account for the missing nested support.

Idea:

  • Re-use Doctrine\ORM\Mapping\* annotation classes and add #[Attribute] as needed.
  • Flatten @JoinTable by introducing new InverseJoinColumn attribute
  • Flatten @Table by allowing Index and UniqueConstraint on the entity/class level.
  • Drop support for named queries and named native queries in Attribute based mapping driver due to their nesting complexity.

created time in 12 days

pull request commentdoctrine/orm

Introduce `getIterable()` on AbstractQuery

Having a purely cosmetic thought here, if the naming "toIterable" would be preferrable over "getIterable".

simPod

comment created time in 12 days

Pull request review commentphp/php-src

Promote warnings to error in DOM ext

 static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, 	fci.retval = &retval;  	if (!zend_make_callable(&fci.function_name, &callable)) {-		php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable));+		zend_throw_error(NULL, "Unable to call handler %s()", ZSTR_VAL(callable));

looks like:

$xpath->registerPhpFunctions(['non_existant']);
Girgias

comment created time in 12 days

PullRequestReviewEvent

PR closed doctrine/orm

Add two new events: initializePersistentCollection and initializeProxy

This pull request adds two new events so that they can be observed from userland. The two new events are

  • initializeProxy: called each time a proxy is initialized
  • initializePersistentCollection: called each time a persistent collection is initialized.

The use case behind this PR is to provide an hook to be able to detect n+1. See n-plus-one-detector

+198 -0

5 comments

7 changed files

danydev

pr closed time in 12 days

pull request commentdoctrine/orm

Add two new events: initializePersistentCollection and initializeProxy

Thank you for your contribution, but it is unlikely we are going to merge this, especially when the use-case is so narrow.

You can see N+1 queries by using an SQL Logger and inspecting the backtrace already, or by using a Profiler and looking at the execution graphs.

danydev

comment created time in 12 days

push eventbeberlei/php-rfc-watch

Benjamin Eberlei

commit sha cdaa891deb766419caaf3481dd458e1c8a7b95bb

Make votes a list in form to avoid invalid form name.

view details

push time in 13 days

pull request commentsymfony/symfony

[VarDumper] Support for ReflectionAttribute

Do you have the stacktrace for the segfault?

derrabus

comment created time in 13 days

issue commentdoctrine/orm

DDC-3174: Query Cache not correct working when using SQLFilter

@oojacoboo @FabienPapet see my last comment please, it explains what the problem is and it details how this can be fixed. It should be relatively simple if you want to give it a try.

doctrinebot

comment created time in 13 days

PR opened php/php-src

Bugfix 80097: Have ReflectionAttribute implement Reflector, __toString

https://bugs.php.net/bug.php?id=80097

Question: Is this the right representation? Also, what about attributes on all reflectors, should we print them as well? so when you echo a ReflectionFunction with an attribute for example.

+41 -1

0 comment

4 changed files

pr created time in 13 days

create barnchbeberlei/php-src

branch : ReflectionAttributeReflector

created branch time in 13 days

pull request commentdoctrine/orm

Improve insert performance with batched insert queries

@guilhermeblanco does this work with goals for Next?

mvorisek

comment created time in 13 days

pull request commentdoctrine/orm

Improve insert performance with batched insert queries

This needs to target 2.8, and the batch size should be globally configurable via Configuration class

mvorisek

comment created time in 13 days

GollumEvent
GollumEvent
GollumEvent

push eventbeberlei/dbal

Benjamin Eberlei

commit sha a7a35ad239749259688bca761fd295511cfff283

Housekeeping

view details

push time in 13 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha cbf6804ecf317967a15554ffe6d03988b58ff927

Bugfix: Checked for wrong exception

view details

push time in 13 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha f90df4a44362df691a05268e5de6b667f71260a5

Address Psalm violation

view details

Benjamin Eberlei

commit sha ee4e1eeff818868bb0945b7eb2739b4c33330b98

Fix phpcs violations

view details

push time in 13 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 804d8b298f7f54ca58f26ab0c8d8b0d141ed0002

Address php-stan violatoins with Exception type-hints.

view details

push time in 13 days

PR opened doctrine/dbal

Reviewers
Revert Exception Class renames
Q A
Type improvement
BC Break yes
Related issues #4253

Summary

This reverts the rename of DBALException and parts of the DriverException to Exception rename. This is based on discussions in Slack and https://github.com/doctrine/coding-standard/pull/219 that the makes the convention of doctrine prefixing Exceptions to avoid confusion with the global Exception or other namespaces using Exception.

Foremost, the DBALException rename is reverted, because its use is widespread in open source and private projects and Exception renames are an easy source for nasty bugs.

But secondarily the Driver\DriverExeption rename to Driver\Exception is also changed to become Driver\LowLevelDriverException. Keeping the name as Driver\DriverException would have been preferrable, but we already have a Exception\DriverException one hierachy above. This is still a BC break, but people rely very little on Driver\DriverException as is.

+435 -429

0 comment

63 changed files

pr created time in 13 days

pull request commentdoctrine/coding-standard

Rework Exception Naming Conventions

You are arguing that its too late to break BC on a coding standard that is 5 years old, with a deterministic 2 lines of XML workaround, and that its better to BC breaks in actual code of Doctrine projects that are 10 years old, with non deterministic code changes?

I fail to see how a coding standard that is unrelated to the primary goal of Doctrine trumps actual code.

beberlei

comment created time in 13 days

pull request commentdoctrine/coding-standard

Rework Exception Naming Conventions

@Ocramius Doctrine is in the game of providing a database abstraction and ORM to users, not in quality assurance and static analysis. The documentation even says The Doctrine Coding Standard is a set of rules for PHP_CodeSniffer and applies to all Doctrine projects.

beberlei

comment created time in 13 days

create barnchbeberlei/dbal

branch : RevertExceptionRenames

created branch time in 13 days

pull request commentdoctrine/coding-standard

Rework Exception Naming Conventions

@lcobucci I'd rather have it that the standard grants no room for interpretation, and override rules point at a code smell, instead of the other way around. Ultimtaely the doctrine/coding-standard is for Doctrine projects. So if external users of our standard would need to disable one of our rules and enable one of Slevomat to get to the old behavior, then I am fine with that compared to our projects maintaining large lists of excemptions in their phpcs.xml

beberlei

comment created time in 13 days

pull request commentdoctrine/coding-standard

Rework Exception Naming Conventions

@ostrolucky i agree, i was just adding the sniff here so that we have a base to work off, I am considering to see where it should go from there.

@morozov your argument misses point, the DBALException is the base exception of the public API of DBAL. All exceptions extend from it. All these Exception have a name that is not Exception, so they can't be mixed up with the global Exception or any other libraries Exception. It does not make sense to prefix DBALTableNotFoundException, because TableNotFoundException is already unique enough.

It is also not really important that DBALException is named what its named and its being used many times. Maybe some 10 years ago we could have named it DBAL\BaseException, but we didn't.

As for renaming DBALException, take open source code, https://grep.app/search?q=DBALException spread around quite a bit. I checked a few private projects, all of them catch DBALException at some low level points a few times. Its a class that really shouldn't be renamed anymore at this point.

@lcobucci My undrestanding of a coding standard is, that is doesn't affect the outside API a lot. Essentially as a user you wouldn't care about the coding standard and if its changing, because it doesn't change the public API. However this rule changes the convention of the Doctrine project in a way that affects outside users quite massively. As such i would say, we should re-consider having it, and instead enforcing the rule that we already follow implicitly

beberlei

comment created time in 14 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventdoctrine/coding-standard

Grégoire Paris

commit sha 06c5f5f5d823ff0c4e4d302fa541af9e3a53b476

Drop Travis It has been fully replaced by Github Actions.

view details

Benjamin Eberlei

commit sha b07bbbc0a5daa169aa66a9077d76437be88c5244

Merge pull request #220 from greg0ire/drop-travis Drop Travis

view details

push time in 15 days

PR merged doctrine/coding-standard

Drop Travis

It has been fully replaced by Github Actions.

+1 -60

0 comment

3 changed files

greg0ire

pr closed time in 15 days

pull request commentphp/php-src

Avoid gap in AST_CLASS child nodes for attributes

Oops :) /cc @kooldev

TysonAndre

comment created time in 16 days

pull request commentdoctrine/dbal

[GH-4243] more sqlite schema manager fixes

@morozov are the Postgresql failures unrelated? https://travis-ci.org/github/doctrine/dbal/jobs/725648695 they suddenly started to pop up, 2.10.x last commit is green.

beberlei

comment created time in 16 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 523cdc0d52f29f80a416727a0362bf91991be709

[GH-4243] Handle sqlite foreign key without constraint_name. When introducing SQLite foreign key support a case was not considered where not Doctrine DBAL is creating the schema, but some other code that is not naming foreign key constraints. This leads to triggr a bug that the code already had but was never before executed.

view details

push time in 16 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha c0d5ffa1c34d8afdf941889bd72c1545bc62a377

Revert "Revert "[GH-4243] Move test up to generic SchemaManagerFunctionalTestCase"" This reverts commit bf724a701581106a698d978c1b862ae587f59bfa.

view details

Benjamin Eberlei

commit sha 308247d5a270b812b527551e6f78b2322659968d

Housekeeping: CS

view details

push time in 16 days

pull request commentdoctrine/dbal

[GH-4243] more sqlite schema manager fixes

@greg0ire shouldn't the SQL in https://github.com/doctrine/dbal/pull/4256/files#diff-ffff5b2690b3aab7bb35b745b6ca89b9R261 already lead to the DROP INDEX problem as well? wondering how to expand the test to get that failure as well.

beberlei

comment created time in 16 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha 80e9f54d42cc0cfa8692d9fbec697b32fafb141f

[GH-4257] Bugfix: SchemaDiff must check for foreign key create/drop support on orphaned foreign keys.

view details

push time in 16 days

pull request commentdoctrine/dbal

[GH-4243] more sqlite schema manager fixes

@morozov i would rather revert to the old test with the SQL and document it, wouldn't it be better to have a working regression test for this?

The test is only relevant on SQLite in anyways, because the other databases did not have this bug, because they don't have supportsCreateDropForeignKey returning false. So its not problematic that we don't cover the abstraction here, as its more a regression test for Sqlite.

It seems i deprecated the necessary method on Table addUnnamedForeignKeyConstraint, though it wouldn't work anymore anyways at it automatically generates a name now. It would be possible using another deprecated method, but thats also a funky way:

$referencingTable->addNamedForeignKeyConstraint(null, ...);
beberlei

comment created time in 16 days

pull request commentdoctrine/dbal

[GH-4243] more sqlite schema manager fixes

@morozov it has to be an sqlite specific test, because the schema that breaks it cannot be created with the Schema abstraction, it will always generate a constraint name.

beberlei

comment created time in 16 days

push eventbeberlei/dbal

Benjamin Eberlei

commit sha bf724a701581106a698d978c1b862ae587f59bfa

Revert "[GH-4243] Move test up to generic SchemaManagerFunctionalTestCase" This reverts commit 0c384b40ee3be0ad35e8399ebc0d0ff270aca0dc.

view details

Benjamin Eberlei

commit sha 544e231e921649379fd11e836406dd9a2d54e97c

Revert test change and use $id instead of $index for consistency.

view details

push time in 16 days

pull request commentdoctrine/dbal

[GH-4243] more sqlite schema manager fixes

@morozov thats bad, for the compare foreign key that is expected, because I added it as a guard for the new continue 2; statements, but for the functional test that means the meaning was lost while converting it from the specific Sqlite test to the generic test. Will look what happened, but I have an idea.

beberlei

comment created time in 16 days

more