profile
viewpoint

drdev/DoctrineORMModule 1

Zend Framework 2 Module for Doctrine ORM

drdev/Flitch 1

PHP Coding Standard Validator

drdev/bootstrap 0

HTML, CSS, and JS toolkit from Twitter (extended by Jasny)

drdev/cfdocs 0

Repository for the cfdocs.org site.

drdev/dlutwbootstrap 0

DluTwBootstrap (ZF2 module)

drdev/DoctrineExtensions 0

Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable

drdev/presentation 0

Presentation files

drdev/readonlyrest-docs 0

Official Documentation of ReadonlyREST Plugin

issue openeddoctrine/orm

Confusing parameter name $classes

See SchemaTool::getUpdateSchemaSql(array $classes) method.

$classes represents array of ClassMetadata, no string class names.

created time in 3 hours

PR opened doctrine/orm

Add psalm annotation to ArrayCollection of Parameters

Without this I always miss Parameters types in collection

+26 -9

0 comment

3 changed files

pr created time in 6 hours

pull request commentdoctrine/orm

Make IdentityFunction handle primary keys when they are part of an association

Any news on this?

MatTheCat

comment created time in 9 hours

issue commentdoctrine/orm

Composite foreign keys with shared columns

Hello, sorry to dig up old topics, I'm trying to find a solution as well to the same kind of issue.

I've setup a demo repository where I can experiment. I opened a PR trying to find a solution to this.

Can you have a look and let me know if it is the same kind of issue that we are having?

scaytrase

comment created time in 9 hours

issue commentdoctrine/orm

DDC-3296: JoinColumns seems to only populate one JoinColumn

I just tested with doctrine/orm 2.8.x-dev and this demo repo I cannot reproduce the issue.

I guess this can be closed.

doctrinebot

comment created time in 10 hours

issue commentdoctrine/orm

InExpression will give Syntax error if using non-named empty array

@Ocramius Open for PR on this change as proposed by @mickadoo? It should result in a query like IN(NULL).

mickadoo

comment created time in 11 hours

issue openedAtlantic18/DoctrineExtensions

SoftDelete messes with "unique" columns

Hi,

I have an issue with soft deleted entities.

Technology: Php 7.4 Symfony 5 Doctrine PostgreSQL

Entity implements SoftDeletable behaviour and has a boolean column named unique (check the sample below).

`` class Foo { use UuidPrimaryKeyEntityTrait; use TimestampableEntity; use SoftDeleteableEntity;

/**
 * @var string
 * @ORM\Column(type="string", length=255)
 */
private $name;

/**
 * @var bool
 * @ORM\Column(type="boolean")
 */
private $required;

/**
 * @var bool
 * @ORM\Column(type="boolean")
 */
private $unique;

``

When I delete an entity and when I fetch it with native query afterwards, it sets the value of $unique field to null even it is not nullable (in database it remains false, so it has to do something with Gedmo bundle and Doctrine, I would say, as well as with the fact that column name is a keyword in most of the database engines). On the other hand, there are no issues with another boolean field $required .

One of the solutions I came up with is to set default value of $unique field which prevents it being set to null but I would like to know what really happens in the background.

Anybody got an idea?

Thanks in advance, Bruno

created time in 14 hours

issue commentAtlantic18/DoctrineExtensions

Bug after composer install

Hi, no answer on this thread so i'm gonna add detail. I got the same problem on existing project in symfony 5.1. You will got this message: Specified non-existing directory ".../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity" as Doctrine mapping source.
by doing the following step:

  • ./composer.phar require gedmo/doctrine-extensions
  • "gedmo/doctrine-extensions": "^3.0" then composer update or deleting all the vendor then composer install.

I didn't had time to find a solution yet but if I find something i'm will post here.

Noido

comment created time in 2 days

issue closeddoctrine/orm

Undefined table: 7 ERROR: missing FROM-clause entry for table

DQL

SELECT o, a, m FROM Acme\Component\Project\Model\Project o  LEFT JOIN o.masterImage m LEFT JOIN o.assets a WHERE o.id = :id

AbstractAsset.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
    <mapped-superclass name="Acme\Component\Media\Model\AbstractAsset" table="Acme_media_asset">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>
        <lifecycle-callbacks>
            <lifecycle-callback type="prePersist" method="prePersist"/>
            <lifecycle-callback type="preUpdate" method="preUpdate"/>
        </lifecycle-callbacks>

        <field name="path" column="path" type="string" nullable="false" />
        <field name="extension" column="extension" type="string" nullable="true" />
        <field name="size" column="file_size" type="integer" nullable="true" />
        <field name="mimeType" column="mime_type" type="string" nullable="false" />
        <field name="originalName" column="original_file_name" type="string" nullable="true" />
        <field name="createdAt" column="created_at" type="datetime"/>
        <field name="updatedAt" column="updated_at" type="datetime" nullable="true"/>
    </mapped-superclass>
</doctrine-mapping>

ProjectAsset.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Acme\Component\Project\Model\ProjectAsset" table="Acme_project_asset">
        <many-to-one target-entity="Acme\Component\Project\Model\ProjectInterface" field="project" inversed-by="assets" >
            <join-column name="project_id" referenced-column-name="id"/>
        </many-to-one>
    </entity>
</doctrine-mapping>

Project.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
    <entity name="Acme\Component\Project\Model\Project" 
            table="Acme_project"
            repository-class="Acme\Component\Project\Persistence\Doctrine\ProjectRepository"
        >
        <id name="id" type="uuid" >
            <generator strategy="NONE"/>
        </id>
        <one-to-many target-entity="Acme\Component\Project\Model\ProjectAsset" mapped-by="project" field="assets">
            <cascade>
                <cascade-all/>
            </cascade>
        </one-to-many>
        <one-to-one target-entity="Acme\Component\Media\Model\Asset" field="masterImage">
            <cascade>
                <cascade-all/>
            </cascade>
        </one-to-one>
    </entity>
</doctrine-mapping>

Asset.orm.xml

<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
    <entity name="Acme\Component\Media\Model\Asset" table="Acme_media_asset">
        
    </entity>
</doctrine-mapping>

closed time in 2 days

videni

fork weierophinney/laminas-component-installer

Composer plugin for injecting modules and configuration providers into application configuration

https://docs.laminas.dev/laminas-component-installer/

fork in 2 days

startedOverLordGoldDragon/see-rnn

started time in 2 days

pull request commentdoctrine/orm

fix(persistent-collection): check "association" is not nullable before using it as an array

Hum, I don't understand why the CI is failing. For me my changes are unrelated to the failed tests.. :/

Kocal

comment created time in 2 days

PR opened doctrine/orm

fix(persistent-collection): check "association" is not nullable before using it as an array

Hi,

Today I've faced an issue with Doctrine 2.7 and https://github.com/KnpLabs/DoctrineBehaviors when configuring the parameter doctrine_behaviors_translatable_fetch_mode to LAZY (see KnpDoctrineBehaviors Translatable configuration):

image

By using xdebug, I found it was coming from the method PersistentCollection#get() which try to use $this->association when it is equal to null: 2020-11-30_16-36

There are already some methods that check if $this->association !== null:

  • changed: https://github.com/doctrine/orm/blob/e0eb82a/lib/Doctrine/ORM/PersistentCollection.php#L294
  • remove: https://github.com/doctrine/orm/blob/e0eb82a/lib/Doctrine/ORM/PersistentCollection.php#L357
  • removeElement: https://github.com/doctrine/orm/blob/e0eb82a/lib/Doctrine/ORM/PersistentCollection.php#L380
  • count: https://github.com/doctrine/orm/blob/e0eb82a/lib/Doctrine/ORM/PersistentCollection.php#L443

So I've applied the same patch on all other methods that use $this->association without checking its value.

WDYT? Thanks!

+11 -9

0 comment

1 changed file

pr created time in 2 days

issue commentAtlantic18/DoctrineExtensions

How to use uuid in nested tree entity?

Hello i think you misunderstand how a tree works. Left and right are always int. They aren't related with id.

vittore

comment created time in 3 days

issue openedAtlantic18/DoctrineExtensions

Incorrect Type in phpdoc

Hi, i found a missing type in the phpdoc for Gedmo\Tree\Entity\Repository\NestedTreeRepository::getChildren() the $sortByField parameter can also be an array of string

Best regards

created time in 3 days

fork Ocramius/laminas-code

Extensions to the PHP Reflection API, static code scanning, and code generation

https://docs.laminas.dev/laminas-code/

fork in 3 days

create barnchrevive-adserver/revive-adserver

branch : crowdin-335

created branch time in 3 days

PR opened revive-adserver/revive-adserver

New translations

Imported automatically from Crowdin

+21 -0

0 comment

3 changed files

pr created time in 3 days

issue openeddoctrine/orm

How to bind object params to raw sql

Consider this simplified example:

$count = $em->createQuery('SELECT COUNT(o.id) FROM Contract o WHERE o.user = :user')
    ->setParameter('user', $user)  // $user is an object
    ->getQuery()->getSingleScalarResult();

This is very similar how pagination tools work, including one in Doctrine. The problem is that this will count all matches in table, thus making it pretty slow after few million rows.

And honestly; no one need something like you have 1.200.000 results at the cost of speed. But having something like there is more than 1.000 matches, please add more filters is something usable.

So I tried to limit COUNT and this worked:

SELECT COUNT(*) 
FROM (
    SELECT id FROM contract WHERE user_id="15"  LIMIT 1000
    ) AS id ;

but we can't put subquery in FROM.


Now here is the question; once I extract SQL from $qb and wrap it like in example, how do I bind object params and arrays to NativeQuery?

I tried everything for hours, probably running in circles now... SO didn't help and it is important to reduce load time.


The example is oversimplified, it is actually full of conditions based on filters user selected. But it is important to bind params like in $qb->setParameter('user', $user).

created time in 3 days

issue commentdoctrine/orm

Entities with custom DBAL type identifier bound to DQL query parameters are not converted through DBAL types

Same issue on 2.8.x-dev

It seems that QueryBuilder tries to serialize object instead of using its primary key:

$qb = $this->createQueryBuilder(static::TRANSLATION_ALIAS);
$qb->select(static::TRANSLATION_ALIAS . '.id')
    ->innerJoin('t.nodeSources', static::NODESSOURCES_ALIAS)
    ->andWhere($qb->expr()->eq(static::NODESSOURCES_ALIAS . '.node', ':node'))
    ->addOrderBy('t.defaultTranslation', 'DESC')
    ->addOrderBy('t.locale', 'ASC')
    ->setParameter('node', $node)
    ->setCacheable(true);
n1_.node_a_id = ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? 
with params [7, false, false, false, false, false, false, false, false, false, false, false, false]:

To fix this I need to use $node->getId():

$qb = $this->createQueryBuilder(static::TRANSLATION_ALIAS);
$qb->select(static::TRANSLATION_ALIAS . '.id')
    ->innerJoin('t.nodeSources', static::NODESSOURCES_ALIAS)
    ->andWhere($qb->expr()->eq(static::NODESSOURCES_ALIAS . '.node', ':node'))
    ->addOrderBy('t.defaultTranslation', 'DESC')
    ->addOrderBy('t.locale', 'ASC')
    ->setParameter('node', $node->getId())
    ->setCacheable(true);
Ocramius

comment created time in 3 days

issue commentdoctrine/orm

PHP 8 compatibility

Yep, i think declaring 2.8 compatibility with PHP 8.0 is useless because 2.x will not support doctrine/dbal:3.x

DBAL 2.12 supports PHP 8, what’s the issue exactly?

my bad, didnt see that

BenMorel

comment created time in 3 days

issue commentdoctrine/orm

PHP 8 compatibility

Yep, i think declaring 2.8 compatibility with PHP 8.0 is useless because 2.x will not support doctrine/dbal:3.x

DBAL 2.12 supports PHP 8, what’s the issue exactly?

BenMorel

comment created time in 3 days

issue openeddoctrine/orm

Undefined table: 7 ERROR: missing FROM-clause entry for table

DQL

SELECT o, t, attr, a FROM Acme\Component\Project\Model\Project o LEFT JOIN o.tags t LEFT JOIN o.masterImage m LEFT JOIN o.attributes attr LEFT JOIN o.assets a WHERE o.id = :id

AbstractAsset.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
    <mapped-superclass name="Acme\Component\Media\Model\AbstractAsset" table="Acme_media_asset">
        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>
        <lifecycle-callbacks>
            <lifecycle-callback type="prePersist" method="prePersist"/>
            <lifecycle-callback type="preUpdate" method="preUpdate"/>
        </lifecycle-callbacks>

        <field name="path" column="path" type="string" nullable="false" />
        <field name="extension" column="extension" type="string" nullable="true" />
        <field name="size" column="file_size" type="integer" nullable="true" />
        <field name="mimeType" column="mime_type" type="string" nullable="false" />
        <field name="originalName" column="original_file_name" type="string" nullable="true" />
        <field name="createdAt" column="created_at" type="datetime"/>
        <field name="updatedAt" column="updated_at" type="datetime" nullable="true"/>
    </mapped-superclass>
</doctrine-mapping>

ProjectAsset.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Acme\Component\Project\Model\ProjectAsset" table="Acme_project_asset">
        <many-to-one target-entity="Acme\Component\Project\Model\ProjectInterface" field="project" inversed-by="assets" >
            <join-column name="project_id" referenced-column-name="id"/>
        </many-to-one>
        <many-to-one target-entity="Acme\Component\Project\Model\AssetGroup" field="group">
        </many-to-one>
    </entity>
</doctrine-mapping>

Project.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"
                  xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping">
    <entity name="Acme\Component\Project\Model\Project" 
            table="Acme_project"
            repository-class="Acme\Component\Project\Persistence\Doctrine\ProjectRepository"
        >
        <id name="id" type="uuid" >
            <generator strategy="NONE"/>
        </id>
        <one-to-many target-entity="Acme\Component\Project\Model\ProjectAsset" mapped-by="project" field="assets">
            <cascade>
                <cascade-all/>
            </cascade>
        </one-to-many>
        <one-to-one target-entity="Acme\Component\Media\Model\Asset" field="masterImage">
            <cascade>
                <cascade-all/>
            </cascade>
        </one-to-one>
    </entity>
</doctrine-mapping>

Asset.orm.xml

<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
    <entity name="Acme\Component\Media\Model\Asset" table="Acme_media_asset">
        
    </entity>
</doctrine-mapping>

created time in 4 days

issue commentdoctrine/orm

PHP 8 compatibility

2.8 seems currently tied to dbal 2.10, but not dbal 3:

- doctrine/orm 2.8.x-dev requires doctrine/dbal ^2.10.0 -> found doctrine/dbal[v2.10.0, ..., 2.12.x-dev] but it conflicts with your root composer.json require (^3.0).

Yep, i think declaring 2.8 compatibility with PHP 8.0 is useless because 2.x will not support doctrine/dbal:3.x

@beberlei what do you think ?

BenMorel

comment created time in 4 days

issue commentdoctrine/orm

PHP 8 compatibility

2.8 seems currently tied to dbal 2.10, but not dbal 3:

- doctrine/orm 2.8.x-dev requires doctrine/dbal ^2.10.0 -> found doctrine/dbal[v2.10.0, ..., 2.12.x-dev] but it conflicts with your root composer.json require (^3.0).
BenMorel

comment created time in 4 days

PR closed doctrine/orm

Fixed commit order Bug

Fixes visit method of CommitOrderCalculator.

Without the fix the insertion order is not properly calculated when a cycle within the graph involves more than 2 classes, leading to a violation of not null constraints on the owning side of ManyToOne relation.

With the fix when a cycle is detected a node is revisited ignoring edges of weight 0.

+5573 -6056

5 comments

662 changed files

tomaszgaw

pr closed time in 4 days

pull request commentdoctrine/orm

Fixed commit order

Closing in favor of #8349

tomaszgaw

comment created time in 4 days

PR opened doctrine/orm

Add docs to export-ignore
+1 -0

0 comment

1 changed file

pr created time in 5 days

more