[DDC-3706] DQL parsing fail when using COUNT with "Simple Derived Identity" primary key Created: 21/Apr/15  Updated: 21/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: Git Master, 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Dmitry Korotovsky Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: bidirectional, count, onetoone, parser
Environment:

Mac osx Maverick
PHP 5.5.13
Nginx 1.6.0
Mysql 5.6.19


Attachments: File DDC3331Test.php    

 Description   

There is the regression https://github.com/doctrine/doctrine2/commit/097840dc935e1cfbc93fc673be077a8fe67e8e52

commit 097840dc935e1cfbc93fc673be077a8fe67e8e52
Author: Marco Pivetta <ocramius@gmail.com>
Date: Wed Aug 27 01:56:11 2014 +0200

Allowing expression in `COUNT()` DQL aggregation functions

:040000 040000 5d5f12583a38f54e5966b1cb65dfe487d932a728 982b2c8642e311730b48c6e5d6e6740c97e3bd5c M lib

On Doctrine 2.5.0 FOSElasticaBundle doesn't work completely

$ php app/console fos:elastica:populate --env=test
Resetting users
Refreshing users

[Doctrine\ORM\Query\QueryException]
[Semantical Error] line 0, col 13 near 'a) FROM F\Q\C\N\Entity\UserProfile': Error: Invalid PathExpression. Must be a StateFieldPathExpression.

[Doctrine\ORM\Query\QueryException]
SELECT COUNT(a) FROM F\Q\C\N\Entity\UserProfile a






[DDC-3705] Order by With Equals is not supported Created: 20/Apr/15  Updated: 20/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Alexey Kosov Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: dql


 Description   

Related to this issue: http://www.doctrine-project.org/jira/browse/DDC-2204
Solution proposed by Benjamin Eberlei doesn't work so the issue it still unresolved.

SELECT
e.status = 1 AS HIDDEN orderField
FROM
Entity e
ORDER BY
orderField DESC

Doctrine\ORM\Query\QueryException
\vendor\doctrine\orm\lib\Doctrine\ORM\Query\QueryException.php:52
[Syntax Error] line 0, col 47: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '='






[DDC-3704] [GH-1390] Document the ChainCache class Created: 20/Apr/15  Updated: 20/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of deviantintegral:

Url: https://github.com/doctrine/doctrine2/pull/1390

Message:

I was thisclose to writing a ChainCache class myself, and only avoided it by actually looking in the source. There's no mention of ChainCache on Google, probably because there's no docs for it. ChainCache is a bit different from other drivers in that it's something implementers will want to use in their own code in place of an ArrayCache or static array. However, I also added a link to the cache drivers given there's quite a few that aren't mentioned in the docs.






[DDC-3703] [GH-1389] Fix Lexer::match() so it does not accept T_WHERE when T_WITH is supposed to be matched Created: 19/Apr/15  Updated: 19/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mpdude:

Url: https://github.com/doctrine/doctrine2/pull/1389

Message:

http://www.doctrine-project.org/jira/browse/DDC-3701



 Comments   
Comment by Matthias Pigulla [ 19/Apr/15 ]

This is the PR for DDC-3701. Please close or mark as duplicate of DDC-3701, whatever your workflow is.





[DDC-3702] [GH-1388] Fix Lexer::match() so it does not accept T_WHERE when T_WITH is supposed to be matched Created: 19/Apr/15  Updated: 19/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of mpdude:

Url: https://github.com/doctrine/doctrine2/pull/1388

Message:

See http://www.doctrine-project.org/jira/browse/DDC-3701.



 Comments   
Comment by Doctrine Bot [ 19/Apr/15 ]

A related Github Pull-Request [GH-1388] was closed:
https://github.com/doctrine/doctrine2/pull/1388

Comment by Matthias Pigulla [ 19/Apr/15 ]

Please disregard / close.





[DDC-3701] Questions regarding Parser::match and "identifier" EBNF Created: 19/Apr/15  Updated: 19/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Matthias Pigulla Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I am currently investigating a problem where I am suspecting the DQL parser to wrongly transform a DQL statement to SQL. While I haven't yet found the exact reason (will open a new case for it), I have come across the following in the Parser::match() method:

   if ($lookaheadType !== $token && $token !== Lexer::T_IDENTIFIER && $lookaheadType <= Lexer::T_IDENTIFIER) {
      $this->syntaxError($this->lexer->getLiteral($token));
   }

The if-condition was changed a while ago in order to allow DQL terms like WHERE to appear as identifiers.

I think that the condition is wrong as it will only fail (create the syntax error) when the actual token does not match the expected type, we're not expecting an "identifier" and the next token is something special like punctuation that could not serve as an identifier.

So, for example when we're match()ing a T_WITH, a T_WHERE will be accepted as well. A correct check would probably not solve my actual problem, but it would probably have been spotted much earlier due to syntax errors issued.

IMO this should actually read

if ($lookaheadType !== $token && ($token !== Lexer::T_IDENTIFIER || $lookaheadType <= Lexer::T_IDENTIFIER)) { ... syntax error ... }

That is, fail if the token does not match the expectation; and when the expectation is T_IDENTIFIER, also accept every terminal string that can also be considered an "identifier".

With this change, the tests almost pass. The only problem is when a FROM clause expects an "identifier" and now a fully qualified class name starting with a backslash is no longer accepted.

Unfortunately, I also did not manage to find an exact definition of "identifier" somewhere in the EBNF. Lexer::getType() considers everything that starts with a character or underscore an identifier, but that does not match FQCNs.

As there seems to be no special token for backslashes, I tried allowing the backslash as a starting character for identifiers as well (in the Lexer), and it seems to work (all non-skipped tests pass).

What do you think about it? Is that something we should fix and does my change make sense?






[DDC-3700] orderBy stopped working after upgrading to 2.5v (Column not found error) Created: 19/Apr/15  Updated: 19/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Khurshid Yalgashev Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: orderBy
Environment:

ubuntu 14.04


Attachments: JPEG File sl_notification.jpg    

 Description   

Hi,
I have this very simple method in my repository class which fetches a list as query builder object:

public function fetchListAsQueryBuilder(User $user, $receiverType, $limit, $offset)
{
    $queryBuilder = $this->getEntityManager()->createQueryBuilder();
    $query = $queryBuilder
        ->select(['no'])
        ->from('SLCoreBundle:Notification', 'no')
        ->where('no.receiver = :user')
        ->andWhere('no.receiverType = :receiverType')
        ->orderBy('no.createdAt', 'DESC')
        ->setParameters([
            'user' => $user,
            'receiverType' => $receiverType,
        ])
        ->setMaxResults($limit)
        ->setFirstResult($offset)
    ;

    return $query;
}

After upgrading to v2.5 it stopped working and is giving this error:

An exception occurred while executing 'SELECT DISTINCT id_6 FROM (SELECT s0_.receiver_type AS receiver_type_0, s0_.importance AS importance_1, s0_.seen AS seen_2, s0_.deleted AS deleted_3, s0_.created_at AS created_at_4, s0_.updated_at AS updated_at_5, s0_.id AS id_6, s0_.reason AS reason_7 FROM sl_notification s0_ WHERE s0_.receiver_id = ? AND s0_.receiver_type = ?) dctrn_result ORDER BY s0_.created_at DESC LIMIT 25 OFFSET 0' with params [2, 1]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 's0_.created_at' in 'order clause'

My entity has been configured like this:

Mapped superclass AbstractMessage:

abstract class AbstractMessage
{
    use CreatedUpdatedAtTrait;

    // here go properties, setters and getter

Notification class:

class Notification extends AbstractMessage
{
    // here go properties, setters and getters

And CreateUpdatedAtTrait:

trait CreatedUpdatedAtTrait
{
    /**
     * @var \DateTime
     */
    private $createdAt;

    /**
     * @var \DateTime
     */
    private $updatedAt;

    // Here go setters and getters
}

Schema (AbstractMessage) :

<mapped-superclass name="SL\CoreBundle\Entity\AbstractMessage">

    ... 

    <field name="createdAt" column="created_at" type="datetime">
        <gedmo:timestampable on="create" />
    </field>

    <field name="updatedAt" column="updated_at" type="datetime">
        <gedmo:timestampable on="update" />
    </field>

</mapped-superclass>

I'dont understand what causes this error, my others entities work well with this trait, and also my other queries with orderBy method and mappedsuperclass classes work without any error. And also very interesting part is if I remove orderBy my method is working and I am able to get the createdAt value ($object->getCreatedAt()).

PS// Reference: http://stackoverflow.com/questions/29715104/error-with-orderby-column-not-found






[DDC-3699] [GH-1387] Fix skipping properties if they are listed after a not loaded relation. Created: 17/Apr/15  Updated: 18/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of lenardpalko:

Url: https://github.com/doctrine/doctrine2/pull/1387

Message:

This issue fixes an issue that occurs when merging entites, when the entity that is being merged has some other properties after a association type field.

Fixes the following scenario :
Your entity extends a parent entity and when it is merged by the entity manager first its fields are computed, this is done correctly bby `ReflectionPropertiesGetter::getProperties()`, but in the `mergeEntityStateIntoManagedCopy` method the iteration is stopped when it gets to a field that is a relationship and it is Proxy and was not loaded yet.
The order in which the fields are computed is : current class properties and then the parent properties, so if the current class has a lazy loaded relationship then the properties of the parent are not merged.

So the fix doesn't stop the iteration it just skips the current property that is not loaded yet and goes to the next property.



 Comments   
Comment by Doctrine Bot [ 18/Apr/15 ]

A related Github Pull-Request [GH-1387] was labeled:
https://github.com/doctrine/doctrine2/pull/1387





[DDC-3698] [GH-1386] PersisterException: missing license added Created: 17/Apr/15  Updated: 18/Apr/15  Resolved: 18/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1386

Message:



 Comments   
Comment by Doctrine Bot [ 18/Apr/15 ]

A related Github Pull-Request [GH-1386] was merged:
https://github.com/doctrine/doctrine2/pull/1386





[DDC-3697] WHERE conditions can get moved into JOIN conditions with JOINed Inheritance and non-association-JOINs Created: 17/Apr/15  Updated: 17/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Malte Wunsch Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: dql, orm


 Description   

With the following entities:

/**
 * @ORM\Entity()
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="discriminaor", type="integer")
 * @ORM\DiscriminatorMap({"1" = "GeneralEntity", "2" = "SpecializedEntity"})
 */
class GeneralEntity {
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    protected $id;
}

/**
 * @ORM\Entity()
 */
class SpecializedEntity extends GeneralEntity {
}

you can create a DQL query (note we're JOINing freely here without traversing a defined association) like

SELECT g1.id
FROM GeneralEntity g1
JOIN GeneralEntity g2
WHERE g2.id = 1

This gets converted to the following SQL:

SELECT g0_.id AS id0
FROM GeneralEntity g0_
LEFT JOIN SpecializedEntity s1_ ON g0_.id = s1_.id
INNER JOIN GeneralEntity g2_
LEFT JOIN SpecializedEntity s3_ ON g2_.id = s3_.id AND (g2_.id = 1)

As you can see, the condition in the WHERE part (g2.id = 1) is no longer in a WHERE clause by it's own, but got moved to the LEFT JOIN of the table inheritance. In this simple special case it probably makes no difference, but in general it does and leads to wrong results.






[DDC-3696] flushing traversable objects Created: 17/Apr/15  Updated: 18/Apr/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.5, 2.5.1
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: mw Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: orm, unitofwork


 Description   

Hi,

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L331

it would be easier if you could the method "flush" pass a traversable object. I've implement this behavior in my decorated entity manager. In my opinion this should be an official supported behavior.

The new code should be inside of Orm\UnitOfWork::commit($entity = null) and looks like the following code:

// Compute changes done since last commit.
if( $entity instanceof \Traversable ) {
	$entity = iterator_to_array( $entity );
}

By the way, the foreach part can be simplified to one line. This can be made possible by array_walk.
You can use:

} elseif (is_array($entity)) {
	array_walk($entity, array($this, 'computeSingleEntityChangeSet'));
}

Now, the new code in one piece:

// Compute changes done since last commit.
if( $entity instanceof \Traversable ) {
	$entity = iterator_to_array( $entity );
}

if ($entity === null) {
	$this->computeChangeSets();
} elseif (is_object($entity)) {
	$this->computeSingleEntityChangeSet($entity);
} elseif (is_array($entity)) {
	array_walk($entity, array($this, 'computeSingleEntityChangeSet'));
}

Thanks in advance.



 Comments   
Comment by Marco Pivetta [ 17/Apr/15 ]

Two things:

1) we are more inclined to remove the parameter from flush(), as it was exploited for purposes it wasn't designed for.
2) what happens if you persist an entity that is a traversable?

Comment by mw [ 17/Apr/15 ]

1.Is that really planned? I guess this is a helpful feature and makes not a difference if you flush a small collection of entities before you flush the remaining entities without the parameter.

2. The object will be treated as entity, because it's an object. This will throw an "Doctrine\ORM\Mapping\MappingException" exception with following message:

Class "SplObjectStorage" is not a valid entity or mapped super class.
Exception-Class: Doctrine\ORM\Mapping\MappingException 
Exception-Code: 0 
Exception-File: Composer/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php 
Exception-Line: 346

This simple senseless code shows you what you can do to test this behavior.

$em = Doctrine_Factory::getEntityManager();
$em->persist($entity);
$x = new SplObjectStorage();
$x->attach($entity);
$em->flush($x);
Comment by Marco Pivetta [ 17/Apr/15 ]

You can implement the Traversable interface (as iterator or iteratoraggregate) on any entity.

As for "planned", it obviously won't happen in 2.x.

We are mainly interested in finding better ways to speed up flush() operations rather than delegating transactional boundaries knowledge to the user.

Anyway, so far, flush($entities) has been more of a source of bugs rather than an actual useful API.

Comment by mw [ 18/Apr/15 ]

The Traversable interface serves to detect whether a class is traversable using foreach. The flush parameter surrenders this parameter one-to-one to $this->unitOfWork->commit($entity).
What I want to do is to hand over an traversable object to the method EntityManager::flush with a collection of entities instead of an single entity object. It's also possible to pass a collection of entities as array. But it's not possible to pass a collection of entities as an object, because when passing an object UnitOfWork::commit assumes that it's an entity. To implement the Traversable interface on any entity will not help and is not the same intention. Because an Traversable object it means, that is a collection of entities like an array.

In my opinion there are not objections that speak against it to support traversable object (SplObjectStorage, ArrayIterator, ArrayObject).

There are two ways to do that.

The first option would be:

// Compute changes done since last commit.
if( $entity instanceof \Traversable ) {
	$entity = iterator_to_array( $entity );
}

if ($entity === null) {
	$this->computeChangeSets();
} elseif (is_object($entity)) {
	$this->computeSingleEntityChangeSet($entity);
} elseif (is_array($entity)) {
	array_walk($entity, array($this, 'computeSingleEntityChangeSet'));
}

The second option would be:

// Compute changes done since last commit.
if ($entity === null) {
	$this->computeChangeSets();
} elseif (is_array($entity) || $entity instanceof \Traversable) {
	foreach ($entity as $object) {
		$this->computeSingleEntityChangeSet($object);
	}
} elseif (is_object($entity)) {
	$this->computeSingleEntityChangeSet($entity);
}

By the way: the SplObjectStorage object has the benefit that every entity is present only once.





[DDC-3695] [GH-1385] duplicated param in phpdoc Created: 17/Apr/15  Updated: 18/Apr/15  Resolved: 18/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1385

Message:



 Comments   
Comment by Doctrine Bot [ 18/Apr/15 ]

A related Github Pull-Request [GH-1385] was merged:
https://github.com/doctrine/doctrine2/pull/1385





[DDC-3694] [GH-1384] cs Created: 17/Apr/15  Updated: 18/Apr/15  Resolved: 18/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Improvement Priority: Trivial
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: code-style, coding-standards, cs


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1384

Message:



 Comments   
Comment by Doctrine Bot [ 18/Apr/15 ]

A related Github Pull-Request [GH-1384] was merged:
https://github.com/doctrine/doctrine2/pull/1384





[DDC-3693] Notify change tracking policy breaks in the face of individual entity flushes Created: 15/Apr/15  Updated: 15/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.2, 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Michael Nielsen Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The notify change tracking policy breaks, if other entities are individually flushed between change and flush on a given notify-based entity.

The culprit seems to be that UnitOfWork.commit() resets its scheduledForSynchronization and entityChangeSets arrays (name(s) has changed since 2.2.2) - even when the commit is for a single entity, and the arrays hold other scheduled entities/changes.

An example:

use \net\jay\test\A;

$em = \Doctrine2::getEntityManager();

# persist and flush two instances of A
$a1 = new A(1, 'x');
$a2 = new A(2, 'y');
$em->persist($a1);
$em->persist($a2);
$em->flush();

# change both, but flush $a2 first, then do a general flush
$a1->setName('xx');
$a2->setName('yy');
$em->flush($a2);
$em->flush();

# $a1 entity should be changed, but isn't
$em->clear();
$a1 = $em->getRepository('net\jay\test\A')->find(1);
echo $a1->getName(); # = 'x' (should be 'xx')
namespace net\jay\test;

/**
 * @Entity
 * @ChangeTrackingPolicy("NOTIFY")
 */
class A implements \Doctrine\Common\NotifyPropertyChanged
{
	/** @Id @Column(type="integer") */
	private $id;
	
	/** @Column(length=100) */
	private $name;
	
	private $_changeListeners;
	
	public function __construct($id, $name)
	{
		$this->id = $id;
		$this->name = $name;
	}
	
	public function addPropertyChangedListener(\Doctrine\Common\PropertyChangedListener $listener)
	{
		$this->_changeListeners[] = $listener;
	}
	
	private function _onPropertyChanged($propName, $oldValue, $newValue)
	{
		if ($this->_changeListeners)
		{
			foreach ($this->_changeListeners as $listener)
			{
				$listener->propertyChanged($this, $propName, $oldValue, $newValue);
			}
		}
	}
	
	public function getID()
	{
		return $this->id;
	}
	
	public function getName()
	{
		return $this->name;
	}
	
	public function setName($name)
	{
		$this->_onPropertyChanged('name', $this->name, $name);
		$this->name = $name;
	}
}





[DDC-3692] [GH-1383] DDC-3691 add test case Created: 14/Apr/15  Updated: 14/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of XitasoChris:

Url: https://github.com/doctrine/doctrine2/pull/1383

Message:

Test case for DDC-3691






[DDC-3691] Filtering by 'date' column does not return enough values on SQLite Created: 14/Apr/15  Updated: 17/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: XitasoChris Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 8.1 x64
PHP 5.6.2
date.timezone => Europe/Berlin


Attachments: Zip Archive sandbox.zip    

 Description   

When using a column of type 'date' in a where clause, filtering fails and does not return entries which clearly should match.

I have implemented a small proof of concept on the Doctrine sandbox. You can find it by checking out my branch at https://github.com/XitasoChris/doctrine2/tree/date_filter_bug and then run the tools/sandbox/index.php . Alternatively, I have zipped the sandbox folder and attached it to this bug report.

I don't know whether this affects other database systems as well. I only tested it on SQLite.



 Comments   
Comment by Marco Pivetta [ 14/Apr/15 ]

Linking the diff: https://github.com/doctrine/doctrine2/compare/master...XitasoChris:date_filter_bug

Should be a test case, XitasoChris - can you convert it?

Comment by XitasoChris [ 14/Apr/15 ]

@Marco: I will try, though I have never done that on the doctrine project before.

Comment by XitasoChris [ 14/Apr/15 ]

Test case created: https://github.com/doctrine/doctrine2/pull/1383

Comment by XitasoChris [ 17/Apr/15 ]

After some more debugging: The problem is that the type of the parameter is inferred as "datetime", leading Doctrine to format the value as "2015-03-01 00:00:00". However, SQLite needs the value formatted as "2015-03-01" to find a match.

A workaround is to tell Doctrine to format the parameter as a date [$queryBuilder->setParameter("date", $date, "date")] and then the test case works fine.

My question now is: is this behavior expected? If so, then the bug report is probably invalid.





[DDC-3690] PersistentCollection uses private property Created: 14/Apr/15  Updated: 15/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.5
Fix Version/s: 2.5.1
Security Level: All

Type: Bug Priority: Blocker
Reporter: Roel Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: collection, persistent-collection, release


 Description   

1. PersistentCollection in Doctrine 2.5 makes uses of the $initialized property defined in the AbstractLazyCollection of doctrine\collection (https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/PersistentCollection.php#L113)
2. Doctrine 2.5 depends on version ~1.2 of doctrine\collection that marks the $initialized property as private https://github.com/doctrine/collections/blob/v1.2/lib/Doctrine/Common/Collections/AbstractLazyCollection.php
3. Hence writing to the initialized variable fails. And thus code related to initialization fails.

A fix is already applied to doctrine\orm https://github.com/doctrine/collections/commit/e2eef4629349fd847c8e080b8f729ab33e81e10f but is not tagged. Possible fix would be to release a new version of doctrine\collection as 1.2.1.



 Comments   
Comment by Roel [ 14/Apr/15 ]

Due to this several tests fail in our code-base.

Comment by Marco Pivetta [ 14/Apr/15 ]

This is a bug caused by the fact that ORM 2.5 should depend on Collections 1.3.0 - I'll look into it ASAP.

Comment by Marco Pivetta [ 15/Apr/15 ]

Collections 1.3.0 was released, but I'll keep this open until ORM 2.5.1 is out.





[DDC-3689] [GH-1382] Patch second level cache association hydration Created: 14/Apr/15  Updated: 15/Apr/15  Resolved: 14/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Second Level Cache
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: cache, orm

Issue Links:
Reference
is referenced by DDC-3687 Entities part of a hierarchy seem not... Open

 Description   

This issue is created automatically through a Github pull request on behalf of holtkamp:

Url: https://github.com/doctrine/doctrine2/pull/1382

Message:

Fixed incorrect use of keys in DefaultRegion::getMultiple() and simplified overall mechanism



 Comments   
Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was labeled:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was assigned:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was merged:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Guilherme Blanco [ 14/Apr/15 ]

Master: https://github.com/doctrine/doctrine2/commit/5f1861835535c5bd90cf69f5a24f65488975a073
2.5: https://github.com/doctrine/doctrine2/commit/3e6c6af8456a1b2a1ecd5c868be6f792bc857828

Comment by Doctrine Bot [ 15/Apr/15 ]

A related Github Pull-Request [GH-1382] was unassigned:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 15/Apr/15 ]

A related Github Pull-Request [GH-1382] was assigned:
https://github.com/doctrine/doctrine2/pull/1382





[DDC-3688] Order By column doesn't have number suffix in Paginator Created: 13/Apr/15  Updated: 13/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Thomas Koch Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 1
Labels: None


 Description   
An exception occurred while executing 'SELECT DISTINCT IDuser_16 FROM (SELECT a0_.username AS username_0, a0_.username_canonical AS username_canonical_1, a0_.email AS email_2, a0_.email_canonical AS email_canonical_3, a0_.enabled AS enabled_4, a0_.salt AS salt_5, a0_.password AS password_6, a0_.last_login AS last_login_7, a0_.locked AS locked_8, a0_.expired AS expired_9, a0_.expires_at AS expires_at_10, a0_.confirmation_token AS confirmation_token_11, a0_.password_requested_at AS password_requested_at_12, a0_.roles AS roles_13, a0_.credentials_expired AS credentials_expired_14, a0_.credentials_expire_at AS credentials_expire_at_15, a0_.IDuser AS IDuser_16, a0_.uname AS uname_17, a0_.uprename AS uprename_18, a0_.status AS status_19, a0_.FKIDare AS FKIDare_20, a0_.IDparent AS IDparent_21 FROM aus2_users a0_ WHERE a0_.status IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) dctrn_result ORDER BY a0_.username ASC LIMIT 10 OFFSET 0' with params [1, 2, 5, 6, 8, 9, 10, 11, 12, 13, 14]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a0_.username' in 'order clause'

Stacktrace: 
[1] Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing 'SELECT DISTINCT IDuser_16 FROM (SELECT a0_.username AS username_0, a0_.username_canonical AS username_canonical_1, a0_.email AS email_2, a0_.email_canonical AS email_canonical_3, a0_.enabled AS enabled_4, a0_.salt AS salt_5, a0_.password AS password_6, a0_.last_login AS last_login_7, a0_.locked AS locked_8, a0_.expired AS expired_9, a0_.expires_at AS expires_at_10, a0_.confirmation_token AS confirmation_token_11, a0_.password_requested_at AS password_requested_at_12, a0_.roles AS roles_13, a0_.credentials_expired AS credentials_expired_14, a0_.credentials_expire_at AS credentials_expire_at_15, a0_.IDuser AS IDuser_16, a0_.uname AS uname_17, a0_.uprename AS uprename_18, a0_.status AS status_19, a0_.FKIDare AS FKIDare_20, a0_.IDparent AS IDparent_21 FROM aus2_users a0_ WHERE a0_.status IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) dctrn_result ORDER BY a0_.username ASC LIMIT 10 OFFSET 0' with params [1, 2, 5, 6, 8, 9, 10, 11, 12, 13, 14]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a0_.username' in 'order clause'
    at n/a
        in /home/dev/git/comsolit/kurad/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 71

    at Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception occurred while executing 'SELECT DISTINCT IDuser_16 FROM (SELECT a0_.username AS username_0, a0_.username_canonical AS username_canonical_1, a0_.email AS email_2, a0_.email_canonical AS email_canonical_3, a0_.enabled AS enabled_4, a0_.salt AS salt_5, a0_.password AS password_6, a0_.last_login AS last_login_7, a0_.locked AS locked_8, a0_.expired AS expired_9, a0_.expires_at AS expires_at_10, a0_.confirmation_token AS confirmation_token_11, a0_.password_requested_at AS password_requested_at_12, a0_.roles AS roles_13, a0_.credentials_expired AS credentials_expired_14, a0_.credentials_expire_at AS credentials_expire_at_15, a0_.IDuser AS IDuser_16, a0_.uname AS uname_17, a0_.uprename AS uprename_18, a0_.status AS status_19, a0_.FKIDare AS FKIDare_20, a0_.IDparent AS IDparent_21 FROM aus2_users a0_ WHERE a0_.status IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) dctrn_result ORDER BY a0_.username ASC LIMIT 10 OFFSET 0' with params [1, 2, 5, 6, 8, 9, 10, 11, 12, 13, 14]:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a0_.username' in 'order clause'', object(PDOException))
        in /home/dev/git/comsolit/kurad/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 116

    at Doctrine\DBAL\DBALException::driverExceptionDuringQuery(object(Driver), object(PDOException), 'SELECT DISTINCT IDuser_16 FROM (SELECT a0_.username AS username_0, a0_.username_canonical AS username_canonical_1, a0_.email AS email_2, a0_.email_canonical AS email_canonical_3, a0_.enabled AS enabled_4, a0_.salt AS salt_5, a0_.password AS password_6, a0_.last_login AS last_login_7, a0_.locked AS locked_8, a0_.expired AS expired_9, a0_.expires_at AS expires_at_10, a0_.confirmation_token AS confirmation_token_11, a0_.password_requested_at AS password_requested_at_12, a0_.roles AS roles_13, a0_.credentials_expired AS credentials_expired_14, a0_.credentials_expire_at AS credentials_expire_at_15, a0_.IDuser AS IDuser_16, a0_.uname AS uname_17, a0_.uprename AS uprename_18, a0_.status AS status_19, a0_.FKIDare AS FKIDare_20, a0_.IDparent AS IDparent_21 FROM aus2_users a0_ WHERE a0_.status IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) dctrn_result ORDER BY a0_.username ASC LIMIT 10 OFFSET 0', array('1', '2', '5', '6', '8', '9', '10', '11', '12', '13', '14'))
        in /home/dev/git/comsolit/kurad/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 836

    at Doctrine\DBAL\Connection->executeQuery('SELECT DISTINCT IDuser_16 FROM (SELECT a0_.username AS username_0, a0_.username_canonical AS username_canonical_1, a0_.email AS email_2, a0_.email_canonical AS email_canonical_3, a0_.enabled AS enabled_4, a0_.salt AS salt_5, a0_.password AS password_6, a0_.last_login AS last_login_7, a0_.locked AS locked_8, a0_.expired AS expired_9, a0_.expires_at AS expires_at_10, a0_.confirmation_token AS confirmation_token_11, a0_.password_requested_at AS password_requested_at_12, a0_.roles AS roles_13, a0_.credentials_expired AS credentials_expired_14, a0_.credentials_expire_at AS credentials_expire_at_15, a0_.IDuser AS IDuser_16, a0_.uname AS uname_17, a0_.uprename AS uprename_18, a0_.status AS status_19, a0_.FKIDare AS FKIDare_20, a0_.IDparent AS IDparent_21 FROM aus2_users a0_ WHERE a0_.status IN (?)) dctrn_result ORDER BY a0_.username ASC LIMIT 10 OFFSET 0', array(array('1', '2', '5', '6', '8', '9', '10', '11', '12', '13', '14')), array('102'), null)
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php line 50

    at Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(object(Connection), array(array('1', '2', '5', '6', '8', '9', '10', '11', '12', '13', '14')), array('102'))
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php line 321

    at Doctrine\ORM\Query->_doExecute()
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php line 969

    at Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(null, '3')
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php line 924

    at Doctrine\ORM\AbstractQuery->execute(null, '3')
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php line 751

    at Doctrine\ORM\AbstractQuery->getScalarResult()
        in /home/dev/git/comsolit/kurad/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/Paginator.php line 151

    at Doctrine\ORM\Tools\Pagination\Paginator->getIterator()
        in  line 

    at iterator_to_array(object(Paginator))

I use the doctrine paginator on a normal FosUserBundle user entity. It worked with doctrine-common 2.4.2, -orm 2.4.7 and throws this exception with doctrine 2.5.

While I stepped through the code with xdebug I got this notice once, but I can't reproduce it anymore:

Notice: Undefined property: Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker::$queryComponents in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 1369

with this stacktrace:

at SqlWalker ->walkSelectExpression (object(SelectExpression)) 
at array_map (array(object(LimitSubqueryOutputWalker), 'walkSelectExpression'), array(object(SelectExpression))) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 699   + 
at SqlWalker ->walkSelectClause (object(SelectClause)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 521   + 
at SqlWalker ->walkSelectStatement (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php at line 492   + 
at LimitSubqueryOutputWalker ->getInnerSQL (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php at line 271   + 
at LimitSubqueryOutputWalker ->walkSelectStatementWithoutRowNumber (object(SelectStatement), false) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php at line 319   + 
at LimitSubqueryOutputWalker ->addMissingItemsFromOrderByToSelect (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php at line 263   + 
at LimitSubqueryOutputWalker ->walkSelectStatementWithoutRowNumber (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php at line 184   + 
at LimitSubqueryOutputWalker ->walkSelectStatement (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php at line 42   + 
at SingleSelectExecutor ->__construct (object(SelectStatement), object(LimitSubqueryOutputWalker)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php at line 277   + 
at SqlWalker ->getExecutor (object(SelectStatement)) 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php at line 390   + 
at Parser ->parse () 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 281   + 
at Query ->_parse () 
in vendor/doctrine/orm/lib/Doctrine/ORM/Query.php at line 293   + 
at Query ->_doExecute () 
in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 969   + 
at AbstractQuery ->executeIgnoreQueryCache (null, '3') 
in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 924   + 
at AbstractQuery ->execute (null, '3') 
in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php at line 751   + 
at AbstractQuery ->getScalarResult () 
in vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Pagination/Paginator.php at line 151   + 
at Paginator ->getIterator () 
at iterator_to_array (object(Paginator)) 
in src/Comsolit/KuradBundle/Util/PaginatorJsonResponse.php at line 76   + 

Maybe this is related to DDC-3434?



 Comments   
Comment by Thomas Koch [ 13/Apr/15 ]

Our user class has a relation to another entity:

     /**
     * @ORM\ManyToOne(targetEntity="Organization", fetch="EAGER")
     * @ORM\JoinColumn(name="id", referencedColumnName="organization_id", nullable=true)
     * @var \Comsolit\EntityOrganization
     */
    private $organization;




[DDC-3687] Entities part of a hierarchy seem not to inherit SLC configuration from 'root' Entity Created: 13/Apr/15  Updated: 15/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Second Level Cache
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Documentation Priority: Minor
Reporter: Menno Holtkamp Assignee: Fabio B. Silva
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Reference
relates to DDC-3689 [GH-1382] Patch second level cache as... Resolved

 Description   

When using the Second Level Cache on associations, the documentation states that "the target entity must also be marked as cacheable"

It seems that when this targetEntity is an (possibly abstract) 'root' Entity of an Entity hierarchy, all Entities of that hierarchy need to be marked as cacheable. I would expect that all Entities that are part of the Entity hierarchy, also inherit this cache configuration metadata of the root Entity...

Is this intended behavior?

For example, this does NOT work:

Entity
 - cacheable X-to-many association, targetEntity: RootEntity

RootEntity, SINGLE_TABLE (marked as cacheable)
 - SubEntity1
 - SubEntityN

The generated error:

Array
(
    [type] => 1
    [message] => Call to a member function resolveAssociationEntries() on a non-object
    [file] => /srv/www/code/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php
    [line] => 92
)

For example, this does DOES work

Entity
 - cacheable X-to-many association, targetEntity: RootEntity

RootEntity, SINGLE_TABLE 
 - SubEntity1 (marked as cacheable)
 - SubEntityN (marked as cacheable)


 Comments   
Comment by Fabio B. Silva [ 13/Apr/15 ]

Hi Menno Holtkamp All subclasses should already Inherit the cache configuration .

Can please attach your entities/mapping ?

Comment by Menno Holtkamp [ 13/Apr/15 ]

Mm, you are right, the cache configuration seems to be inherited. General idea of my Mapping is at the end of this comment.

The error occurs after the cache has been filled (2nd request). The following CollectionCacheEntry is used to lookup the EntityEntries:

identifiers => Array ( [0] => Doctrine\ORM\Cache\EntityCacheKey Object ( [identifier] => Array ( [id] => 357 )
entityClass => Project\Domain\Entity\Cms\Page\SectionAbstract
hash => project.domain.entity.cms.page.sectionabstract_357

This results in a $entityEntries collection with one entry, (which is empty!) as retrieved from cache at:
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php#L84

array(1) {
  [0] =>
  NULL
}

Having a look at the actual content of the SLC cache shows that the entry exists, so the lookup goes wrong. It seems 'DefaultRegion::getMultiple()' contains a bug:

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php#L122

$returnableItems[$index] = $items[$key];

Should be

$returnableItems[$index] = $items[$index];

Since the $items array uses the same keys as the $keysToRetrieve array, filled at https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Cache/Region/DefaultRegion.php#L106

My mapping (pseudo-code)

/**
 * @Entity
 * @Cache
 */
class Page
{
	/**
	 * @OneToMany
	 * @Cache
	 */
	private $translations;
}

/**
 * @Entity
 * @Cache
 */
class Translation
{
	/**
	 * @ManyToOne
	 */
	private $page;
	
	/**
	 * @OneToMany
	 * @Cache
	 */
	private $sections;
}

/**
 * @Entity
 * @Cache
 */
abstract class SectionAbstract
{
	/**
	 * @ManyToOne
	 */
	private $pageTranslation;
}

/**
 * @Entity
 */
class SectionFaq extends SectionAbstract
{

	/**
	 * @var string
	 */
	private $answer;
	
	/**
	 * @var string
	 */
	private $question;
}

/**
 * @Entity
 */
class SectionText extends SectionAbstract
{
	/**
	 * @var string
	 */
	private $content;
}
Comment by Fabio B. Silva [ 13/Apr/15 ]

Yes, it looks like a bug on DefaultRegion::getMultiple()
Can you try to write a failing test case or/and maybe send a PR ?

Comment by Menno Holtkamp [ 13/Apr/15 ]

Mm, will try to find some time this week. Not very experienced in writing test cases though...

Comment by Fabio B. Silva [ 13/Apr/15 ]

Cool,
Take a look at : SecondLevelCacheTest and let me know if you need help..

Comment by Menno Holtkamp [ 13/Apr/15 ]

Ok, challenge accepted, got a test case running in this branch, I used:

php ./vendor/bin/phpunit -v --exclude-group performance,non-cacheable,locking_functional --filter DefaultRegionTest

It seems the way DefaultRegion::getMultiple() works is overcomplicated? Maybe just return the $items array as an end-result?

Comment by Fabio B. Silva [ 13/Apr/15 ]

If you want to refactory it some how, that will be great..
DefaultRegion::getMultiple tries to check if all keys are found in the cache, and then maps it back to the original key
If any of then are missing it will return null which will trigger a new database query to reload the entries and repopulate the cache.

Overall you branch seems good, Can you send a PR please ?

Comment by Menno Holtkamp [ 14/Apr/15 ]

Ok, I gave it a shot at https://github.com/doctrine/doctrine2/pull/1382, AFAIK the index of the resulting array can just be numeric, right?

Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was labeled:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was assigned:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 14/Apr/15 ]

A related Github Pull-Request [GH-1382] was merged:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 15/Apr/15 ]

A related Github Pull-Request [GH-1382] was unassigned:
https://github.com/doctrine/doctrine2/pull/1382

Comment by Doctrine Bot [ 15/Apr/15 ]

A related Github Pull-Request [GH-1382] was assigned:
https://github.com/doctrine/doctrine2/pull/1382





[DDC-3686] cascade with inheritence objects Created: 12/Apr/15  Updated: 13/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: sky diablo Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

this is just a dummy text, i create a unittest-case to demonstrate the issue. so i need this DDC-Number for...



 Comments   
Comment by sky diablo [ 13/Apr/15 ]

hmmm.. i have create a new unittest with my issue, but no error :| i will add some more tests and give here a sign later...

Comment by sky diablo [ 13/Apr/15 ]

i have create a new unittest in my doctrine2 ORM fork: https://github.com/skydiablo/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3686Test.php all works fine, but in my real enviroment, it dosnt, here the effected code:

class Dossier {

    /**
     * @ORM\ManyToOne(targetEntity="Reference", cascade={"all"})
     * @ORM\JoinColumn(name="reference_id", referencedColumnName="id")
     */
    private $reference;
}

class Reference {

    /**
     * @ORM\ManyToOne(targetEntity="Company", cascade={"all"})
     * @ORM\JoinColumn(name="company_id", referencedColumnName="id", nullable=true)
     */
    private $company;
}

/**
 * Class ParticipantObject
 *
 * @ORM\Entity()
 * @ORM\Table(name="company_participant_object")
 * @ORM\InheritanceType(value="JOINED")
 * @ORM\DiscriminatorColumn(name="discriminator", type="string", length=45)
 * @ORM\DiscriminatorMap({
 *      "company" = "Company"
 * })
 */
abstract class ParticipantObject {

}

class Company extends ParticipantObject {

    /**
     * @ORM\ManyToOne(targetEntity="CompanyData", cascade={"all"})
     * @ORM\JoinColumn(name="company_data_id", referencedColumnName="id")
     */
    private $companyData;
}

class CompanyData {

    /**
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
     */
    private $name = '';
}

all classes are annotated with a entity and table declaration. so this entitys should be the same as in my unittest. but in my real enviroment, the "company_id" in the "reference" object will never persist? and i do not know why ??? all other entitys are saved, the new "company" entity is persist ans stored in the database with the "CompanyData" and "ParticipantObject", all works fine... all data available in the database, but the "company_id" in the "reference" object is missing .... ahhhhhhh !!! whats wrong ?





[DDC-3685] wrong bit check ? Created: 12/Apr/15  Updated: 12/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: sky diablo Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

this is just a hint:

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L716

i think it is a good idea to use a bit save check, like:

if (($assoc['type'] & ClassMetadata::TO_ONE) == ClassMetadata::TO_ONE) {






[DDC-3684] [GH-1381] Fixes ClassMetadata wakeupReflection with embeddable and StaticReflectio... Created: 11/Apr/15  Updated: 13/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of nicovogelaar:

Url: https://github.com/doctrine/doctrine2/pull/1381

Message:

...nService

When the `StaticReflectionService` is used, then the wakeupReflection will cause an error with embedded properties. This is because the `getAccessibleProperty` method of the `StaticReflectionService` will always return null, so the parentReflFields will only have null values.

I found this problem when I was generating a Symfony form based on an entity with embedded properties.



 Comments   
Comment by Doctrine Bot [ 13/Apr/15 ]

A related Github Pull-Request [GH-1381] was labeled:
https://github.com/doctrine/doctrine2/pull/1381

Comment by Doctrine Bot [ 13/Apr/15 ]

A related Github Pull-Request [GH-1381] was assigned:
https://github.com/doctrine/doctrine2/pull/1381





[DDC-3683] [GH-1380] Fix issue with second-level-cache tests and versioned entities Created: 10/Apr/15  Updated: 10/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Second Level Cache
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: cache, testing, version

Issue Links:
Dependency
is required for DDC-3681 [GH-1378] Feature to force-increment ... Awaiting Feedback

 Description   

This issue is created automatically through a Github pull request on behalf of DHager:

Url: https://github.com/doctrine/doctrine2/pull/1380

Message:

I'm not sure why this bug doesn't show normally `master`, but I ran across it with build [3930.1](https://travis-ci.org/doctrine/doctrine2/jobs/57975906), where it complained since `$targetPersister` was not an instance of `CachedPersister`.

The immediate fix seems straightforward, because `DefaultCollectionHydrator` doesn't even accept the second argument.

@FabioBatSilva : Please let me know if you see some better resolution to this, or if it indicates some edge-case in the second-level-cache logic that requires a new test.






[DDC-3682] [GH-1379] Added missing 'new' keyword for logger instantiation Created: 09/Apr/15  Updated: 18/Apr/15  Resolved: 18/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, Second Level Cache
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of holtkamp:

Url: https://github.com/doctrine/doctrine2/pull/1379

Message:



 Comments   
Comment by Doctrine Bot [ 18/Apr/15 ]

A related Github Pull-Request [GH-1379] was merged:
https://github.com/doctrine/doctrine2/pull/1379





[DDC-3681] [GH-1378] Feature to force-increment entity version Created: 09/Apr/15  Updated: 10/Apr/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Minor
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: persister, unitofwork, versioned

Issue Links:
Dependency
depends on DDC-3683 [GH-1380] Fix issue with second-level... Open
Duplicate
is duplicated by DDC-3640 Force version increment via mapped pr... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of DHager:

Url: https://github.com/doctrine/doctrine2/pull/1378

Message:

Submitting for feedback and experimentation.

The major use-case for this involves using certain entities as the versioned-gatekeepers for changes that don't directly live on the same entity. For example, using the version of a `PurchaseOrder` to control changes to any of its child `PurchaseOrderLineItem` objects.






[DDC-3680] [GH-1377] Failing test case for broken paginator case Created: 08/Apr/15  Updated: 09/Apr/15  Resolved: 09/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.5
Fix Version/s: 2.5.1
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Bill Schaller
Resolution: Fixed Votes: 0
Labels: limitsubqueryoutputwalker, mysql, paginator


 Description   

This issue is created automatically through a Github pull request on behalf of fprochazka:

Url: https://github.com/doctrine/doctrine2/pull/1377

Message:

http://www.doctrine-project.org/jira/browse/DDC-3679



 Comments   
Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1377] was assigned:
https://github.com/doctrine/doctrine2/pull/1377

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1377] was labeled:
https://github.com/doctrine/doctrine2/pull/1377

Comment by Doctrine Bot [ 09/Apr/15 ]

A related Github Pull-Request [GH-1377] was merged:
https://github.com/doctrine/doctrine2/pull/1377





[DDC-3679] Paginator generates broken SQL when paginating ordered query Created: 08/Apr/15  Updated: 09/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Filip Procházka Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 1
Labels: dql, mysql, orm


 Description   

I have a following DQL

SELECT ra FROM Damejidlo\Recipes\RecipeAuthor ra ORDER BY ra.id ASC

Which generates following SQL

SELECT r0_.id AS id_0, r0_.name AS name_1, r0_.perex AS perex_2, r0_.is_active AS is_active_3, r0_.on_homepage AS on_homepage_4, r0_.content AS content_5, r0_.photo AS photo_6, r0_.link AS link_7 FROM recipes_authors r0_ ORDER BY r0_.id ASC

Now I wanna paginate it

$query = $em->createQuery($dql);
$paginated = new \Doctrine\ORM\Tools\Pagination\Paginator($query, TRUE);

the generated SQL Count query is

SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id_0 FROM (SELECT r0_.id AS id_0, r0_.name AS name_1, r0_.perex AS perex_2, r0_.is_active AS is_active_3, r0_.on_homepage AS on_homepage_4, r0_.content AS content_5, r0_.photo AS photo_6, r0_.link AS link_7 FROM recipes_authors r0_ ORDER BY r0_.id ASC) dctrn_result) dctrn_table

Next executed query is the query that selects ids for where in

SELECT DISTINCT id_0 FROM (SELECT r0_.id AS id_0, r0_.name AS name_1, r0_.perex AS perex_2, r0_.is_active AS is_active_3, r0_.on_homepage AS on_homepage_4, r0_.content AS content_5, r0_.photo AS photo_6, r0_.link AS link_7 FROM recipes_authors r0_) dctrn_result ORDER BY r0_.id ASC LIMIT 5 OFFSET 0

And there goes my problem

Doctrine\DBAL\Exception\InvalidFieldNameException

An exception occurred while executing '...': SQLSTATE[42S22]: Column not found: 1054 Unknown column 'r0_.id' in 'order clause'

I'm going to investigate more, I just wanned to open an issue for now so you're aware.



 Comments   
Comment by Filip Procházka [ 08/Apr/15 ]
aa80c7d!orm $> bisect start
aa80c7d!orm $> bisect bad
aa80c7d!orm $> bisect good v2.4.7
Bisecting: a merge base must be tested
[29d6da0fa063d55d06117045f3446b2716202d2b] Merge pull request #703 from shulcsm/patch-1
29d6da0!orm $> bisect good
Bisecting: 912 revisions left to test after this (roughly 10 steps)
[a2e0133a94bf235498ee2e805c8ca9a147b7fa24] Adding DDC-3276 test group
a2e0133!orm $> bisect good
Bisecting: 456 revisions left to test after this (roughly 9 steps)
[dde09872df4f442f3a2a4c9ce6053badb8b49012] #1172 - writing a more concise test case about merging detached proxies
dde0987!orm $> bisect good
Bisecting: 233 revisions left to test after this (roughly 8 steps)
[d024193cc0d106d4939bbf698f840ef122602d64] Merge pull request #1272 from Ocramius/hotfix/DDC-2704-merge-inherited-transient-properties
d024193!orm $> bisect good
Bisecting: 116 revisions left to test after this (roughly 7 steps)
[6cf76158a07219529631f7b8fb43c3b92d3552be] Merge pull request #1329 from Wilt/patch-1
6cf7615!orm $> bisect good
Bisecting: 58 revisions left to test after this (roughly 6 steps)
[d1a695b42b54ed7deb2f9461fee7d02d32514c3a] Typo in phpdoc
d1a695b!orm $> bisect good
Bisecting: 28 revisions left to test after this (roughly 5 steps)
[b923c937e2194ae38c88e31cfcea8d06b58603fc] Merge branch 'hotfix/#1352-entity-generator-new-class-metadata-hotfix'
b923c93!orm $> bisect good
Bisecting: 14 revisions left to test after this (roughly 4 steps)
[6c5dbd8d4ca4fd68f0d5b2de467c3d2a59e0173c] #1353 #1347 #1351 - Removing double quotes (confusing)
6c5dbd8!orm $> bisect bad
Bisecting: 6 revisions left to test after this (roughly 3 steps)
[af3f5c5c5a93daf240c2daae4eddf9a0628eeb19] Add test for paginating on a query with a subquery in the where clause
af3f5c5!orm $> bisect good
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[b76107e20f7fa893c2e4945a373ff624ed00c0d2] resolve review comments from @stof
b76107e!orm $> bisect bad
Bisecting: 0 revisions left to test after this (roughly 1 step)
[edcc0fc024e0d33a4f6159c006c0f393386dac3a] Fix paginator when ordering by while selecting entities using joined table inheritance
edcc0fc!orm $> bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[09d28819b520b9219bd6f41e8c6e0f4449a3807b] Fix issue where paginating on a query with a subquery in the where clause crashed
09d2881!orm $> bisect good
edcc0fc024e0d33a4f6159c006c0f393386dac3a is the first bad commit
commit edcc0fc024e0d33a4f6159c006c0f393386dac3a
Author: Bill Schaller <bill@zeroedin.com>
Date:   Mon Mar 30 12:16:50 2015 -0400

    Fix paginator when ordering by while selecting entities using joined table inheritance

:040000 040000 aa2bd1b6cb6dc10ef39c3ea1affe78c75bb2b778 4dc9a0e15f847bfc940096263a639d6f1a4eb618 M      lib
:040000 040000 fa9a72d3eaae021b0015e43bbe64a9cf7eadf46e 7b6821dd22bee36c808e4680a427aa3ec75faad0 M      tests
09d2881!orm $>
Comment by Filip Procházka [ 08/Apr/15 ]

I've narrowed down the problem to this piece of code

lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php
+            $fieldMapping = $class->fieldMappings[$columnName];
+            if (isset($fieldMapping['declared']) && $fieldMapping['declared'] !== $class->name) {
+                // Field was declared in a parent class, so we need to get the proper SQL table alias
+                // for the joined parent table.
+                $otherClassMetadata = $this->_em->getClassMetadata($fieldMapping['declared']);
+                $sqlTableAliasForFieldAlias = $this->getSQLTableAlias($otherClassMetadata->getTableName(), $dqlAliasForFieldAlias);
+            }

This breaks the searchPatterns map

Because it thinks it needs to use different table alias for mapped superclass that contains the `id` property.

Comment by Filip Procházka [ 08/Apr/15 ]

I've opened a pullrequest with failing test case https://github.com/doctrine/doctrine2/pull/1377

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1377] was assigned:
https://github.com/doctrine/doctrine2/pull/1377

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1377] was labeled:
https://github.com/doctrine/doctrine2/pull/1377

Comment by Doctrine Bot [ 09/Apr/15 ]

A related Github Pull-Request [GH-1377] was merged:
https://github.com/doctrine/doctrine2/pull/1377





[DDC-3678] [GH-1376] add missing property initialized to PersistentCollection Created: 08/Apr/15  Updated: 08/Apr/15  Resolved: 08/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: collection, initialized, persistent-collection


 Description   

This issue is created automatically through a Github pull request on behalf of odoucet:

Url: https://github.com/doctrine/doctrine2/pull/1376

Message:

This property is accessed from various methods in PersistentCollection, but not declared prior to __construct()



 Comments   
Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1376] was assigned:
https://github.com/doctrine/doctrine2/pull/1376

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1376] was closed:
https://github.com/doctrine/doctrine2/pull/1376





[DDC-3677] [GH-1375] DDC-3671 prevent duplicate unique index Created: 08/Apr/15  Updated: 08/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates DDC-3671 Duplicated unique indexes (@UniqueCon... Open

 Description   

This issue is created automatically through a Github pull request on behalf of webimpress:

Url: https://github.com/doctrine/doctrine2/pull/1375

Message:






[DDC-3676] Entity executing UPDATE on Collection elements with PostLoad callback when cloning Created: 08/Apr/15  Updated: 08/Apr/15  Resolved: 08/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: webDEVILopers Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: PostLoad, clone
Environment:

Debian, Symfony2



 Description   

My `Branch` entity has a collection of `Contract`s.
https://gist.github.com/webdevilopers/65716f36ac2249e5e899#file-branch-php

A `Contract` has a PostLoad event which is converting a legacy yaml database field to a readable format.
https://gist.github.com/webdevilopers/65716f36ac2249e5e899#file-contract-php

When cloning a Branch the database executes a single INSERT for the new branch successfully.
It does NOT persist any collection which is the expected behaviour since I guess relations have to be handled inside the __clone method separately.

But after the INSERT the database also fires an UPDATE on each Contract (currently ~3000 related rows in database) updating the column that was converted inside the PostLoad event.

/**
* @ORM\PostLoad
*
* Legacy workaround converting custom fields yaml to aray
*/
public function convertCustomFieldsYamlToArray()
{
    $customFieldsYaml = $this->getCustomFields();
    if (empty($customFieldsYaml)) { return; }
    $customFields = yaml_parse($customFieldsYaml);
    $this->setCustomFields($customFields);
} 

I think calling the PostLoad is correct. But why is there an additional UPDATE called?

$em = $this->getDoctrine()->getManager();
$branch = $em->getRepository('AppBundle:Branch')->find(1);

dump($branch);
echo "Old ID:" . $branch->getId();

$newBranch = clone $branch;
dump($newBranch);

$em->persist($newBranch);
$em->flush();

dump($newBranch);
echo "<br>New Id:" . $newBranch->getId(); 

https://gist.github.com/webdevilopers/65716f36ac2249e5e899#file-branchcontroller-php

Maybe the flush recognizes changes in the original Branch entity and its Contract collection?

When I add a clear to my __clone method I get ~9 instead of ~3000 UPDATE queries:

    /**
     * @see http://doctrine-orm.readthedocs.org/en/latest/cookbook/implementing-wakeup-or-clone.html
     */
    public function __clone() {
        if ($this->id) {
            $this->contracts->clear();
        }
    }

These 9 remaing UPDATE are additionally fired by another callback:

    /**
     * @ORM\PrePersist
     * @ORM\PreUpdate
     *
     * Legacy workaround converting custom fields to yaml format utf8 encoded
     */
    public function convertCustomFieldsArrayToYaml()
    {
        $customFields = $this->getCustomFields();
        $customFieldsYaml = yaml_emit($customFields, YAML_UTF8_ENCODING);
        $this->setCustomFields($customFieldsYaml);
    }

In summary:
At the bottom line the __clone method causes 9 UPDATE queries for Pre* and ~3000 (number of related database rows) for PostLoad.



 Comments   
Comment by Marco Pivetta [ 08/Apr/15 ]

Resolving as invalid: please provide a small reproducible example that is not specific to your codebase.

As it stands, this seems more like a debugging request.

Comment by webDEVILopers [ 08/Apr/15 ]

Sure Marco, I will add some fixtures to my example to make it reproducable if that is enough for debugging?





[DDC-3675] Additional informations when throwing EntityNotFoundException Created: 08/Apr/15  Updated: 08/Apr/15  Resolved: 08/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Daniel Mecke Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: orm

Issue Links:
Duplicate
duplicates DDC-3479 [GH-1240] Include IDs in the exceptio... Resolved

 Description   

When a EntityNotFoundException is thrown it would be very helpful for debugging to get the informations which entity was not found as well as which identifiers where used for the lookup.



 Comments   
Comment by Daniel Mecke [ 08/Apr/15 ]

Duplicate to DDC-3479

Sorry!





[DDC-3674] Additional informations when closing EntityManager Created: 08/Apr/15  Updated: 08/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Daniel Mecke Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: orm, unitofwork


 Description   

When the EntityManager is closed there is no way to find out why it has been closed afterwards. For example it would be nice if ORMException::entityManagerClosed() could add the information which query caused it to close. That would ease debugging a lot.
Maybe the EntityManager::close() method could get a parameter which stores the query or informations about it in a property next to the EntityManager::closed property?






[DDC-3673] Foreign key ignores options on schema update Created: 07/Apr/15  Updated: 07/Apr/15  Resolved: 07/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.5.1, 2.6.0
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Yuri Pimenov Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: mysql, orm
Environment:

"php": ">=5.3.3", "doctrine/orm": "2.6.*@dev" (tried with several older versions with no success), Mysql configuration in attachment.


Attachments: File mysql_variables.csv    

 Description   

To reproduce create 2 tables:

CREATE TABLE `books` (
  `id` INT UNSIGNED NOT NULL,
  `title` VARCHAR(45) NULL,
  PRIMARY KEY (`id`));

CREATE TABLE `authors` (
  `id` INT UNSIGNED NOT NULL,
  `book_id` INT NOT NULL,
  `name` VARCHAR(45) NULL,
  PRIMARY KEY (`id`));

Pay attention that books.id is UNSIGNED and authors.book_id is not UNSIGNED (default). This is my legacy schema, I reverse engineered it to Doctrine entities like so:

Author.php
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="authors")
 * @ORM\Entity
 */
class Author
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", options={"unsigned"=true})
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

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

    /**
     * @var Book
     *
     * @ORM\ManyToOne(targetEntity="Book")
     * @ORM\JoinColumn(name="book_id", referencedColumnName="id")
     */
    private $book;
}

Book.php
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="books")
 * @ORM\Entity
 */
class Book
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

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

Please notice

options={"unsigned"=true}

in Book.id definition. Actually it does not have an effect (I guess it must).

Then when I run

$> app/console doctrine:schema:update --dump-sql --force

get the mysql error:

ALTER TABLE authors ADD CONSTRAINT FK_8E0C2A5116A2B381 FOREIGN KEY (book_id) REFERENCES books (id);
CREATE INDEX IDX_8E0C2A5116A2B381 ON authors (book_id);
ALTER TABLE books CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE title title VARCHAR(45) NOT NULL;

Updating database schema...

  [Doctrine\DBAL\Exception\DriverException]
  An exception occurred while executing 'ALTER TABLE authors ADD CONSTRAINT FK_8E0C2A5116A2B381 FOREIGN KEY (book_id) REFERENCES books (id)':
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

  [PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constrain

Than if I manually ALTER Author and then add foreign key constraint it works:

ALTER TABLE `authors` 
CHANGE COLUMN `book_id` `book_id` INT(11) UNSIGNED NULL DEFAULT NULL ;

ALTER TABLE authors ADD CONSTRAINT FK_8E0C2A5116A2B381 FOREIGN KEY (book_id) REFERENCES books (id)

But if I run doctrine:schema:update again it recreates definition with the same error:

ALTER TABLE authors DROP FOREIGN KEY FK_8E0C2A5116A2B381;
ALTER TABLE authors CHANGE book_id book_id INT DEFAULT NULL;
DROP INDEX fk_8e0c2a5116a2b381 ON authors;
CREATE INDEX IDX_8E0C2A5116A2B381 ON authors (book_id);
ALTER TABLE authors ADD CONSTRAINT FK_8E0C2A5116A2B381 FOREIGN KEY (book_id) REFERENCES books (id);
ALTER TABLE books CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE title title VARCHAR(45) NOT NULL;

Updating database schema...

  [Doctrine\DBAL\Exception\DriverException]
  An exception occurred while executing 'ALTER TABLE authors ADD CONSTRAINT FK_8E0C2A5116A2B381 FOREIGN KEY (book_id) REFERENCES books (id)':
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

  [PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint


 Comments   
Comment by Yuri Pimenov [ 07/Apr/15 ]

Just checked test setup one more time. options=

{"unsigned":true}

were defined in wrong Entity.





[DDC-3672] After update to 2.5.0 we need left join to order correctly with pagination Created: 07/Apr/15  Updated: 07/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Guilherme Santos Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None
Environment:

MySQL 5.6



 Description   

Before update to 2.5.0 I had follow code working:

$qb = $this->_em->createQueryBuilder()->select('customer')->from('Test\Entity\Customer', 'customer');
$qb->addOrderBy('customer.person', 'ASC');
$paginator = new Paginator($query);
var_dump($paginator->getIterator());

As workaround I had to add:

$qb->leftJoin('customer.person', 'person');
// and update orderBy to
$qb->addOrderBy('person.id', 'ASC');


 Comments   
Comment by Marco Pivetta [ 07/Apr/15 ]

Does

ORDER BY IDENTITY(customer.person)

work?

Comment by Guilherme Santos [ 07/Apr/15 ]

Nop, same error..
Sorry, I don't tell you the error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'c0_.person_id' in 'order clause'
Comment by Christophe Coevoet [ 07/Apr/15 ]

Marco Pivetta Looks like we are still missing a bunch of functional tests for the pagination

Comment by Marco Pivetta [ 07/Apr/15 ]

Christophe Coevoet yeah, a whole lot of them :-\





[DDC-3671] Duplicated unique indexes (@UniqueConstraint annotation) Created: 07/Apr/15  Updated: 08/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Michał Bundyra Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: duplicate, index, schema-tool

Issue Links:
Duplicate
is duplicated by DDC-3677 [GH-1375] DDC-3671 prevent duplicate ... Open

 Description   

In this commit:
https://github.com/doctrine/dbal/commit/fc8beca08600b44e46f7b82998adbcc6d52c31f1
was changed to not checking for if index already exists. After that occur problem with duplicated unique keys (for example migrations try add unique index on the same columns with different index name).

This is an example model:

/**
 * @Entity
 * @Table(name="double_uniq_index_table", uniqueConstraints={
 *   @UniqueConstraint(name="uniq_hash", columns={"hash"})
 * })
 */
class DoubleUniqIndexModel
{
    /** @Id @Column */
    private $id;

    /** @Column(name="hash", type="string", length=8, nullable=false, unique=true) */
    private $hash;
}

and the basic test:

    public function testDoubleUniqIndex()
    {
        $em = $this->_getTestEntityManager();
        $schemaTool = new SchemaTool($em);

        $classes = array(
            $em->getClassMetadata(__NAMESPACE__ . '\\DoubleUniqIndexModel'),
        );

        $schema = $schemaTool->getSchemaFromMetadata($classes);

        $this->assertTrue($schema->hasTable('double_uniq_index_table'));
        $this->assertEquals(2, count($schema->getTable('double_uniq_index_table')->getIndexes()));
    }

(I've added it into: tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php).

Test failures, because generated schema contains three indexes (primary, and two unique on the same column with different names - one auto generated uniq_* and one provided in annotations - uniq_hash).






[DDC-3670] [GH-1374] Fix DDC767Test failing on php7 + pg94 Created: 05/Apr/15  Updated: 06/Apr/15  Resolved: 06/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: fragile-test, pgsql, pgsql-9.4, php-7.0, postgresql, tests, testsuite
Environment:

PHP 7.0 + PGSQL 9.4



 Description   

This issue is created automatically through a Github pull request on behalf of mbeccati:

Url: https://github.com/doctrine/doctrine2/pull/1374

Message:

The failure happens when running the full suite or even just:

```
phpunit tests/Doctrine/Tests/ORM/Functional/Ticket
```

see: https://revive.beccati.com/bamboo/browse/PHP-DOCPG-MAS-164/log

For reference:
```
05-Apr-2015 04:39:42 ...S......................................................... 1342 / 2921 ( 45%)
05-Apr-2015 04:39:43 ........SSS...........................................SS
05-Apr-2015 04:39:43 Fatal error: Argument 1 passed to Doctrine\Tests\Models\CMS\CmsUser::addGroup() must be an instance of Doctrine\Tests\Models\CMS\CmsGroup, null given, called in /home/atlassian/bamboo/xml-data/build-dir/PHP-DOCPG-MAS/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC767Test.php on line 63 and defined in /home/atlassian/bamboo/xml-data/build-dir/PHP-DOCPG-MAS/tests/Doctrine/Tests/Models/CMS/CmsUser.php on line 211
```

I wasn't able to replicate with other PHP versions. On PHP7, running `tests/Doctrine/Tests/ORM/Functional/Ticket` yields 20, 21 and 22 as group IDs, rather than 1, 2, 3. Maybe some cleanup isn't run?

Removing hardocoded IDs seems a sensible thing to do anyway.



 Comments   
Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1374] was assigned:
https://github.com/doctrine/doctrine2/pull/1374

Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1374] was labeled:
https://github.com/doctrine/doctrine2/pull/1374

Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1374] was merged:
https://github.com/doctrine/doctrine2/pull/1374





[DDC-3669] [GH-1373] Add note about "symfony/yaml" dependency for yml mappings Created: 05/Apr/15  Updated: 06/Apr/15  Resolved: 06/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: composer, dependency, mapping, symfony, yaml


 Description   

This issue is created automatically through a Github pull request on behalf of aivus:

Url: https://github.com/doctrine/doctrine2/pull/1373

Message:



 Comments   
Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1373] was assigned:
https://github.com/doctrine/doctrine2/pull/1373





[DDC-3668] [GH-1372] [DDC-3661] Fix count in Doctrine\ORM\LazyCriteriaCollection Created: 05/Apr/15  Updated: 06/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Dependency
depends on DDC-3661 Doctrine\ORM\LazyCriteriaCollection u... Open

 Description   

This issue is created automatically through a Github pull request on behalf of Fedik:

Url: https://github.com/doctrine/doctrine2/pull/1372

Message:

Fix Doctrine\ORM\LazyCriteriaCollection::count() when Criteria::$maxResults defined

ps. I have no idea how to write test for it :speak_no_evil:



 Comments   
Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1372] was labeled:
https://github.com/doctrine/doctrine2/pull/1372





[DDC-3667] Fetch-joining a collection that has a field with a default value of `array` causes a fatal error Created: 05/Apr/15  Updated: 05/Apr/15  Resolved: 05/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Bug Priority: Critical
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: collection, default-value, dql, fetch-join, hydrator, persistent-collection


 Description   

With a class like:

class Foo { private $bar = []; }

Fetch-joining like following (with fetch-joined results) will cause a fatal error:

SELECT f, b FROM Foo f JOIN f.bar b





[DDC-3666] [GH-1371] Readme: drop "Downloads" link Created: 04/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, download, link


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1371

Message:

Probably deprecated option



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1371] was assigned:
https://github.com/doctrine/doctrine2/pull/1371





[DDC-3665] [GH-1370] drop doctrine/common git submodule Created: 04/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: cleanup, git, git-submodule


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1370

Message:

This is managed by composer now



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1370] was assigned:
https://github.com/doctrine/doctrine2/pull/1370

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1370] was labeled:
https://github.com/doctrine/doctrine2/pull/1370

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1370] was merged:
https://github.com/doctrine/doctrine2/pull/1370





[DDC-3664] [GH-1369] Drop empty file Created: 04/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, empty-file, markdown


 Description   

This issue is created automatically through a Github pull request on behalf of DavidPrevot:

Url: https://github.com/doctrine/doctrine2/pull/1369

Message:



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1369] was assigned:
https://github.com/doctrine/doctrine2/pull/1369

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1369] was labeled:
https://github.com/doctrine/doctrine2/pull/1369

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1369] was merged:
https://github.com/doctrine/doctrine2/pull/1369





[DDC-3663] [GH-1368] Readme: coverage badge for 2.4 added Created: 04/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: badges, ci, coverage, documentation


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1368

Message:

I didn't know 2.4 has coverage too. It would be nice to show it too, when it's still active.



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1368] was assigned:
https://github.com/doctrine/doctrine2/pull/1368

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1368] was merged:
https://github.com/doctrine/doctrine2/pull/1368





[DDC-3662] "Improve efficiency of One-To-Many EAGER" still do 2 db request when Criteria::$firstResult set Created: 04/Apr/15  Updated: 05/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Fedir Zinchuk Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In Doctrine 2.5 when I have entity with association One-To-Many and fetch="EAGER", doctrine still do 2 db request , when use Criteria with Criteria::$firstResult and Criteria::$maxResults

last time I tested on Doctrine 2.5 RC 1, and there this have work perfect: doctrine have use JOIN to load association.

I think it get broken between 2.5 rc1 and 2.5

for load the items I use

$criteria->setFirstResult(0);// this and next, cause 2 request per item
$criteria->setMaxResults(10);
$items = $repositiry->matching($criteria);


 Comments   
Comment by Marco Pivetta [ 04/Apr/15 ]

Fedir Zinchuk could you come up with an example?

This looks like logic that goes through the paginator, if I'm not mistaken...

Comment by Fedir Zinchuk [ 05/Apr/15 ]

Example you have entities: Gallery and Image,
where Gallery have field 'images' that is bidirectional association One-To-Many and fetch="EAGER" with Image,
and you load the galleries using matching($criteria), then:

This code will do 1 db request for load Galleries list + 1 db request for each Gallery item, to load its Images

$repositiry = $em->getRepository('Gallery');
$criteria  = Criteria::create();
$criteria->where(Criteria::expr()->eq("published", 1));
$criteria->setFirstResult(0);
$criteria->setMaxResults(20);

$galleries = $repositiry->matching($criteria);

This code will do 1 db request for load All: Galleries and its Images

$repositiry = $em->getRepository('Gallery');
$criteria  = Criteria::create();
$criteria->where(Criteria::expr()->eq("published", 1));

$galleries = $repositiry->matching($criteria);

I use setFirstResult() and setMaxResults() because I use external pagination not from Doctrine.

After small investigation, I found that it because $this->currentPersisterContext->handlesLimits there https://github.com/doctrine/doctrine2/blob/e57be9da5e0c6bb31ac286d213e204784a34aa43/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php#L1221





[DDC-3661] Doctrine\ORM\LazyCriteriaCollection unpredictable count() Created: 04/Apr/15  Updated: 06/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Fedir Zinchuk Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: count, lazy, lazy-criteria-collection, lazy-loading, orm

Issue Links:
Dependency
is required for DDC-3668 [GH-1372] [DDC-3661] Fix count in Doc... Open

 Description   

When criteria has set $maxResults Doctrine\ORM\LazyCriteriaCollection::count() can return different result depend when it was called, before initialize() or after.

When LazyCriteriaCollection not initialized then count() return Total from database,
when LazyCriteriaCollection have been initialized then count() return Total from "collection" that is limited by Criteria::$maxResults.

Example you have 30 items in database and Criteria::$maxResults = 5, then:

$items = $repositiry->matching($criteria);
var_dump($items->count()); // will show 30 items
$items->toArray();
var_dump($items->count()); // will show 5 items

It is very confuse

also I not sure which behaviour is right: it should always return Total from database or Total depend from Criteria::$maxResults



 Comments   
Comment by Marco Pivetta [ 04/Apr/15 ]

This is indeed a bug: consider writing an example test case so that we can work on it.

Comment by Fedir Zinchuk [ 04/Apr/15 ]

I think I found solution, I try make pull request tomorrow

Comment by Fedir Zinchuk [ 05/Apr/15 ]

there it is https://github.com/doctrine/doctrine2/pull/1372

For exaple can take that docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections

For example for User entity:
if you have BirthdayUsers in database 100 and run next code:

$repositiry = $em->getRepository('User');
$criteria = Criteria::create()
    ->where(Criteria::expr()->eq("birthday", "1982-02-17"))
    ->orderBy(array("username" => Criteria::ASC))
    ->setFirstResult(0)
    ->setMaxResults(20)
;
$birthdayUsers = $repositiry->matching($criteria);
var_dump($birthdayUsers->count()); // will show 100 items
$birthdayUsers->toArray();
var_dump($birthdayUsers->count()); // will show 20 items
Comment by Doctrine Bot [ 06/Apr/15 ]

A related Github Pull-Request [GH-1372] was labeled:
https://github.com/doctrine/doctrine2/pull/1372





[DDC-3660] [GH-1367] Made \Doctrine\ORM\Mapping\Driver\DatabaseDriver bit more adapted for extending Created: 04/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: database-driver, extensibility, reverse-engineering


 Description   

This issue is created automatically through a Github pull request on behalf of Nemutaisama:

Url: https://github.com/doctrine/doctrine2/pull/1367

Message:



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1367] was assigned:
https://github.com/doctrine/doctrine2/pull/1367

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1367] was closed:
https://github.com/doctrine/doctrine2/pull/1367





[DDC-3659] [GH-1366] [Documentation] typo fixes Created: 03/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, typo


 Description   

This issue is created automatically through a Github pull request on behalf of shieldo:

Url: https://github.com/doctrine/doctrine2/pull/1366

Message:



 Comments   
Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1366] was assigned:
https://github.com/doctrine/doctrine2/pull/1366

Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1366] was labeled:
https://github.com/doctrine/doctrine2/pull/1366

Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1366] was merged:
https://github.com/doctrine/doctrine2/pull/1366





[DDC-3658] [GH-1365] fix rare query test failures due to nondeterminism without order by clause Created: 03/Apr/15  Updated: 04/Apr/15  Resolved: 04/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: ci, orderBy, orderby, sorting, testing, tests, testsuite, travis


 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1365

Message:

I was wondering why [this travis testrun](https://travis-ci.org/doctrine/doctrine2/jobs/57045280) failed. I investigated and found that the queries involved did not have order by clauses, but were assuming that the query result would return in the same order in which the records were persisted. This is not guaranteed to be the case on most RDBs.

This PR simply adds an order by clause to the queries that will produce a deterministic result and prevent spurious test failures.



 Comments   
Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1365] was assigned:
https://github.com/doctrine/doctrine2/pull/1365

Comment by Doctrine Bot [ 04/Apr/15 ]

A related Github Pull-Request [GH-1365] was closed:
https://github.com/doctrine/doctrine2/pull/1365





[DDC-3657] [GH-1364] [Documentation] correct naming of Embeddable Objects feature Created: 03/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: 2.5
Fix Version/s: 2.5.1
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Bill Schaller
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of shieldo:

Url: https://github.com/doctrine/doctrine2/pull/1364

Message:



 Comments   
Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1364] was merged:
https://github.com/doctrine/doctrine2/pull/1364





[DDC-3656] [GH-1363] remove disclaimer about ORM 2.5 being in beta Created: 03/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5, 2.6.0
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Bill Schaller
Resolution: Fixed Votes: 0
Labels: documentation


 Description   

This issue is created automatically through a Github pull request on behalf of shieldo:

Url: https://github.com/doctrine/doctrine2/pull/1363

Message:



 Comments   
Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1363] was merged:
https://github.com/doctrine/doctrine2/pull/1363

Comment by Doctrine Bot [ 03/Apr/15 ]

A related Github Pull-Request [GH-1363] was assigned:
https://github.com/doctrine/doctrine2/pull/1363





[DDC-3655] [GH-1362] Readme: badges for 2.5 added; 2.3- dropped Created: 03/Apr/15  Updated: 03/Apr/15  Resolved: 03/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.6.0
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: badges, documentation, readme


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1362

Message:

If I understand [2.5 release info](https://github.com/doctrine/doctrine2/releases/tag/v2.5.0) correctly, 2.4 will have last bugfix, then security fixes. I suppose then 2.3 and lower are in EOL, thus not needed to check badge for. Also they don't have any branch.






[DDC-3654] [GH-1360] Fixed misleading typo in Embeddables tutorial Created: 02/Apr/15  Updated: 02/Apr/15  Resolved: 02/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, Mapping Drivers
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: column, column-prefix, documentation, embeddables


 Description   

This issue is created automatically through a Github pull request on behalf of stedekay:

Url: https://github.com/doctrine/doctrine2/pull/1360

Message:



 Comments   
Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1360] was assigned:
https://github.com/doctrine/doctrine2/pull/1360

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1360] was merged:
https://github.com/doctrine/doctrine2/pull/1360

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1360] was labeled:
https://github.com/doctrine/doctrine2/pull/1360





[DDC-3653] [GH-1359] Fixed typo in the documentation Created: 02/Apr/15  Updated: 02/Apr/15  Resolved: 02/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: 2.5
Fix Version/s: 2.5.1, 2.6.0
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: annotation, documentation, mapping, typo


 Description   

This issue is created automatically through a Github pull request on behalf of shiroyuki:

Url: https://github.com/doctrine/doctrine2/pull/1359

Message:



 Comments   
Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1359] was assigned:
https://github.com/doctrine/doctrine2/pull/1359

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1359] was labeled:
https://github.com/doctrine/doctrine2/pull/1359

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1359] was merged:
https://github.com/doctrine/doctrine2/pull/1359





[DDC-3652] Problem with joins between entities without associations Created: 02/Apr/15  Updated: 06/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Eunice Valdez Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Reference
relates to DDC-3410 Allow Query Builder to specify the jo... Open

 Description   

I needed to write a DQL query that selects an entity that is not specified in the FROM part. For that I am using joins between entities without associations. But I found a problem. Let me explain it with the following example:

Here the query I wrote

            SELECT l
            FROM Label l
            JOIN l.product_labels pl
            JOIN pl.product p
            JOIN creams.c WITH c.product = p
            WHERE c.type = 'general_cleaners'
            AND l.name = "Eye cleaners"

This is translated to SQL as:

SELECT 
  l0_.id AS id0, 
  l0_.name AS name1, 
FROM 
  label l0_ 
  INNER JOIN product_label p1_ ON l0_.id = p1_.label_id 
  INNER JOIN product p2_ ON p1_.product_id = p2_.id 
  INNER JOIN creams c3_ 
  AND (c3_.product = p2_.id)  <---- this should be in the WHERE part!
WHERE 
  c3_.type = 'general_cleaners'
 AND l0_.name "Eye cleaners"

What happens is that the query gets all the products with the label "Eye cleaners" and the creams having that belong to those products. But it never filters out the products that have no cream association.

To go around the problem I added the condition

AND c.product = p.id

in the WHERE clause in the DQL query

After searching for the issue I found something related but no the same. So i decided to put my findings under your consideration.

Thanks a lot



 Comments   
Comment by Marco Pivetta [ 06/Apr/15 ]
AND (c3_.product = p2_.id)  <---- this should be in the WHERE part!

Why should it go in the WHERE clause? You specified it on a join WITH condition, which in ORM terms translates to an additional ON clause





[DDC-3651] [GH-1358] Update docs for clear-cache commands Created: 01/Apr/15  Updated: 02/Apr/15  Resolved: 02/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: cache, clear-cache, cli, documentation


 Description   

This issue is created automatically through a Github pull request on behalf of zerocrates:

Url: https://github.com/doctrine/doctrine2/pull/1358

Message:

The current docs appear to refer to an older version of the clear-cache commands.

The "clear all caches" command doesn't appear to exist anymore, and the three more specific options for clearing the metadata, query, and result caches are now separate tasks instead of options on one.



 Comments   
Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1358] was labeled:
https://github.com/doctrine/doctrine2/pull/1358

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1358] was assigned:
https://github.com/doctrine/doctrine2/pull/1358

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1358] was merged:
https://github.com/doctrine/doctrine2/pull/1358





[DDC-3650] [GH-1357] Drop useless execution bit Created: 01/Apr/15  Updated: 02/Apr/15  Resolved: 02/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: file-mode, paginator


 Description   

This issue is created automatically through a Github pull request on behalf of DavidPrevot:

Url: https://github.com/doctrine/doctrine2/pull/1357

Message:



 Comments   
Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1357] was assigned:
https://github.com/doctrine/doctrine2/pull/1357

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1357] was labeled:
https://github.com/doctrine/doctrine2/pull/1357

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1357] was merged:
https://github.com/doctrine/doctrine2/pull/1357





[DDC-3649] [GH-1356] Introduced skipNamespaceInPath and skipNamespacePartInPath properties Created: 01/Apr/15  Updated: 02/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of ancpru:

Url: https://github.com/doctrine/doctrine2/pull/1356

Message:

Hi All,

I've extended the EntityGenerator in order to make handling of namespaces more flexible. Currently the EntityGenerator class creates a full tree based on the namespace under the output-directory. This causes problems in a PSR-4-like environment. Thus, i've introduced two properties in order to manipulate the target path:

skipNamespaceInPath: if true, every class file is put directly into the output-directory. if false (which is the default and equal to the current behaviour), subdirectories based on the namespace are generated.

skipNamespacePartInPath: the part of the namespace to skip, for example if the namespace is 'Foo\Bar\Entities\MyEntity', and skipNamespacePartInPath is set to 'Foo\Bar', the entity MyEntity is generated in the directory 'Entities' under the output-directory.

Andreas



 Comments   
Comment by Doctrine Bot [ 01/Apr/15 ]

A related Github Pull-Request [GH-1356] was labeled:
https://github.com/doctrine/doctrine2/pull/1356

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1356] was assigned:
https://github.com/doctrine/doctrine2/pull/1356





[DDC-3648] [GH-1355] [Docs] TablePrefix example - Check for being the owning side Created: 01/Apr/15  Updated: 02/Apr/15  Resolved: 02/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: cookbook, documentation


 Description   

This issue is created automatically through a Github pull request on behalf of scaytrase:

Url: https://github.com/doctrine/doctrine2/pull/1355

Message:

  • Small fix do get rid of notice `undefined index 'joinTable'` as the inverse side does not declare `joinTable` at all.
  • Shortened access to `$classMetadata->associationMappings[$fieldName]` for read accesses to increase readability


 Comments   
Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1355] was assigned:
https://github.com/doctrine/doctrine2/pull/1355

Comment by Doctrine Bot [ 02/Apr/15 ]

A related Github Pull-Request [GH-1355] was merged:
https://github.com/doctrine/doctrine2/pull/1355





[DDC-3647] [GH-1354] [RFC] Added support for OneToMany with orphanRemoval. Created: 01/Apr/15  Updated: 08/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of guilhermeblanco:

Url: https://github.com/doctrine/doctrine2/pull/1354

Message:

Replacing entire collection now deletes the replaced collection (scheduled for deletion). No event handling is done as it happens at DBAL level.

Fixes DDC-3644



 Comments   
Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1354] was assigned:
https://github.com/doctrine/doctrine2/pull/1354

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1354] was labeled:
https://github.com/doctrine/doctrine2/pull/1354

Comment by Doctrine Bot [ 08/Apr/15 ]

A related Github Pull-Request [GH-1354] was labeled:
https://github.com/doctrine/doctrine2/pull/1354





[DDC-3646] Do not select unused columns in inner queries of Paginator Created: 31/Mar/15  Updated: 14/Apr/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Malte Wunsch Assignee: Steve Müller
Resolution: Unresolved Votes: 1
Labels: paginator
Environment:

In my case MySQL 5.1, other versions or DBMS may optimise that by themselves



 Description   

When a {{Paginator count()}}s, it fires a query like this:

SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id0 FROM (%originalQuery%) dctrn_result) dctrn_table

an getIterator() does something similar for joined collections to get the ids in the first place:

SELECT DISTINCT id0, lastmod11 FROM (%originalQuery%) dctrn_result ORDER BY lastmod11 DESC LIMIT 10 OFFSET 0

My problem is that both the inner queries can be too heavy for a regular temporary table.

At first sight I noticed several LEFT JOIN s that could be stripped from the inner query without changing the result of the outer one. But that might have been a specially easy case, a general optimisation of the JOIN clauses might be harder. I think http://www.doctrine-project.org/jira/browse/DDC-2381 deals with that.

On second thought we noticed some ugly BLOB columns as part of the projection, which unhealthily bloated the temporary table. Ultimately, the BLOBs are needed for the paginated view, but they are neither needed for counting nor for getting the paginated ids.

Hence, I propose to remove unused columns from the projection in the inner queries. "Unused" means not being part of the SELECT or ORDER BY clause in the outer query (and maybe not part of GROUP BY, HAVING... - haven't checked on this yet). The key could be the $innerSql in the LimitSubqueryOutputWalker->walkSelectStatement(), but before investigating further, I'd like to hear from you what you think.



 Comments   
Comment by Marco Pivetta [ 31/Mar/15 ]

Please review https://github.com/doctrine/doctrine2/pull/1353, as it might solve this issue

Comment by Malte Wunsch [ 31/Mar/15 ]

Thanks for your quick reply!

To be honest, I don't fully get the PR. At least it's goals look very different to me. Anyway, in LimitSubqueryOutputWalker the $innerSQL is now being generated in getInnerSQL(). In there, some hiddenAliasResultVariable are set to false (and are later restored) so that the parent SQLWalker can reference selected fields better. This might be a requirement for implementing my idea, but as far as I understand, there are no columns removed from the select clause so far?

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1353] was closed:
https://github.com/doctrine/doctrine2/pull/1353

Comment by Marco Pivetta [ 06/Apr/15 ]

Malte Wunsch the PR is actually related as it affects the selected fields.

Consider checking again against 2.5.0, as we indeed fixed many paginator issues, and this issue needs to be re-validated.

Comment by Malte Wunsch [ 07/Apr/15 ]

Great! I'll be glad to check. It might take some time, as we currently only have PHP 5.3 at our disposal (please don't tell anybody), and Doctrine 2 ORM 2.5.0 requires at least PHP 5.4. Fortunately, this is a very good trigger to put some pressure on the PHP upgrade process. I'll keep my eye on it.

Comment by Malte Wunsch [ 10/Apr/15 ]

Marco Pivetta Unfortunately, Doctrine 2.5 had no effect on my inner original query. It still looks like this:

SELECT 
  COUNT(*) AS dctrn_count 
FROM 
  (
    SELECT 
      DISTINCT id0 
    FROM 
      (
        SELECT 
          [all fields from t0_],
          [all fields from t1_],
          [all fields from t2_],
          [all fields from t3_]
        FROM 
          table1 t0_ 
          LEFT JOINs...
        WHERE 
          ...
        ORDER BY 
          ...
      ) dctrn_result
  ) dctrn_table

Just to be clear, my point is with the most inner query. If I'm correct it is generated in LimitSubqueryOutputWalker->getInnerSql(). In the special case with the query above, one could simplify it by dropping the order clause, removing the left joins and selecting only the id0 field. I have no plan for inner joins and other more complex optimisations, but I guess that removing the unused fields from the select clause might be in reach.

Comment by Matthias Pigulla [ 10/Apr/15 ]

When removing fields from the SELECT clause, we need to keep those that are referenced from GROUP BY or HAVING clauses (when ORDER BY is dropped).

Comment by Matthias Pigulla [ 14/Apr/15 ]

http://www.doctrine-project.org/jira/browse/DDC-2381 seems to be related or identical.





[DDC-3645] [GH-1353] Paginator fixes take3 Created: 27/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: limitsubqueryoutputwalker, paginator

Issue Links:
Duplicate
is duplicated by DDC-3637 [GH-1347] problem with LimitSubqueryO... Resolved
is duplicated by DDC-3642 [GH-1351] Failing test cases regardin... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1353

Message:

This PR fixes issues reported in #1347 and #1351.

  • Ordering a query by a column from an association which uses SINGLE_TABLE inheritance no longer throws an error.
  • Limiting a query which is ordered by fields from a joined -To-Many association now works as expected.

This patch converts LimitSubqueryOutputWalker to use the ROW_NUMBER window function for queries on platforms that support it. Other platforms use a modified version of the previous method. The modification is to not select the ORDER BY columns in the wrapping query. The reason those columns were selected like that in the first place is that ORDER BY on columns not in the select list is unsupported on many platforms. MySQL and SQLite are fine with it, and don't support ROW_NUMBER.

The ROW_NUMBER solution is actually much simpler.

LimitSubqueryOutputWalker SQL generation tests for PG and Oracle have been changed.

*There are 2 failing expectedException tests right now.* The LimitSubqueryWalker needs to be modified to throw an exception when it detects a query that does the following things together:

  • Joins a -To-Many association
  • Orders by a column from the associated entity
  • Limits the result

As with the previous patch, this depends on changes to SQLServerPlatform2008 that have not yet been merged. SQLServerPlatform2008 in DBAL/master currently mangles the generated queries when trying to apply LIMIT/OFFSET.



 Comments   
Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1353] was assigned:
https://github.com/doctrine/doctrine2/pull/1353

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1353] was labeled:
https://github.com/doctrine/doctrine2/pull/1353

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1353] was closed:
https://github.com/doctrine/doctrine2/pull/1353





[DDC-3644] One To Many Relationships do not properly support Orphan Removal Created: 27/Mar/15  Updated: 27/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Jarrett Croll Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

After speaking to @guilhermeblanco you assume the following method is unreachable when in fact it is not:

https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php#L39

If an entity currently has a persistent collection in a 1-m relationship and that persistent collection is replaced with a new collection the entities not contained in that new collection should be scheduled for deletion but they are not.






[DDC-3643] [GH-1352] fix EntityGenerator RegenerateEntityIfExists Created: 27/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5, 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: entityGenerator, metadata


 Description   

This issue is created automatically through a Github pull request on behalf of Fedik:

Url: https://github.com/doctrine/doctrine2/pull/1352

Message:

Fix for Class generator,
when class already exists and `$generator->setRegenerateEntityIfExists(true);`



 Comments   
Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1352] was labeled:
https://github.com/doctrine/doctrine2/pull/1352

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1352] was merged:
https://github.com/doctrine/doctrine2/pull/1352





[DDC-3642] [GH-1351] Failing test cases regarding to #1325 #1337 Created: 27/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: paginator

Issue Links:
Duplicate
duplicates DDC-3645 [GH-1353] Paginator fixes take3 Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of vaheshadunts:

Url: https://github.com/doctrine/doctrine2/pull/1351

Message:



 Comments   
Comment by Doctrine Bot [ 30/Mar/15 ]

A related Github Pull-Request [GH-1351] was closed:
https://github.com/doctrine/doctrine2/pull/1351

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1351] was assigned:
https://github.com/doctrine/doctrine2/pull/1351

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1351] was labeled:
https://github.com/doctrine/doctrine2/pull/1351

Comment by Marco Pivetta [ 31/Mar/15 ]

Merged into DDC-3645 (will be solved there)





[DDC-3641] [GH-1350] Assigned default value to array Created: 26/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: filter, sqlfilter


 Description   

This issue is created automatically through a Github pull request on behalf of mmoreram:

Url: https://github.com/doctrine/doctrine2/pull/1350

Message:

  • For strict configurations of PHP, we were accessing to a non-array element


 Comments   
Comment by Doctrine Bot [ 27/Mar/15 ]

A related Github Pull-Request [GH-1350] was labeled:
https://github.com/doctrine/doctrine2/pull/1350

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1350] was assigned:
https://github.com/doctrine/doctrine2/pull/1350

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1350] was closed:
https://github.com/doctrine/doctrine2/pull/1350





[DDC-3640] Force version increment via mapped property Created: 26/Mar/15  Updated: 09/Apr/15  Resolved: 09/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Darien Hager Assignee: Benjamin Eberlei
Resolution: Duplicate Votes: 0
Labels: mapping, orm

Issue Links:
Duplicate
duplicates DDC-3681 [GH-1378] Feature to force-increment ... Awaiting Feedback
Reference
relates to DDC-2864 New type of lock: OPTIMISTIC_FORCE_IN... Open
relates to DDC-1507 State change detection for version in... Open

 Description   

Existing feature:

It is currently possible to use optimist-locking against an entity through a version code or timestamp, which becomes incremented when the entity changes. Unfortunately, there is no way for an entity to signal that its version should be incremented when no (direct) changes have occurred.

Problem:

Sometimes you want to control or gate wide-spread or indirect changes via a particular entity, such as the root of a tree of other mutable entities. This is particularly common in Domain Driven Design.

Proposal:

Create a new configuration option for a PHP property that identifies it as a "version incrementor flag". It is only legal on entities that also have a version-field. This field will always be set to false when an entity is hydrated.

When entities are being checked for changes and flushed, this flag will (if it evaluates to true) force the version-field to update. Note that if the entity has "real changes", it will be saved and the version-field will update regardless. At the end of this process, the field is reset back to false.

This allows the user to write code such as:

Entity example

    /** @Version @Column(type="integer") */
    private $version;

    /** @VersionIncrementFlag */
    $changed = false;

    /** @OneToMany(targetEntity="Child", mappedBy="parent") */
    private $children;    

    public function zeroChildren(){
        foreach($this->children as $child){
            $child->setValue(0);
        }
        $this->changed = true; // Where $changed is the incrementor flag
    }    

Issues with other approaches:

The current workaround of a "junk column" is... suboptimal. It requires a junk data column in the database, and its presence does not easily capture the intent of the user. It also leads to extra database operations, since the junk data has to be saved no matter what.

Adding a specialized method to EntityManager, like with $em->touchVersion($entity); is also problematic, since it means you cannot conveniently trigger the new behavior when deep inside the object-graph.



 Comments   
Comment by Darien Hager [ 26/Mar/15 ]

I'm willing to try implementing this if folks feel it could get included.

Comment by Darien Hager [ 27/Mar/15 ]

I have a proof-of-concept working based off of 2.4.7, you can see a diff here:

https://github.com/doctrine/doctrine2/compare/2.4...DHager:force_version_increment

As of this writing, it can only be configured via XML. Here's a minimal example, for a table that has only two columns, an ID and a version.

<?xml version="1.0" encoding="utf-8"?>
<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="Example\Foo" table="example">

    <special-properties>
        <special-property name="vflag" type="versionIncFlag"/>
    </special-properties>

    <id name="id" type="integer" column="id"/>

    <field name="version" type="integer" column="version" version="true" nullable="false"/>

  </entity>
</doctrine-mapping>

The new <special-properties> section is intended to refer to PHP object-properties which are not mapped fields, but which still have significance to Doctrine. In PHP-land, it's as simple as:

        $targetId = 1;
        /** @var $em EntityManager */                
        /** @var $foo Foo */
        $foo = $em->find("Example\Foo",$targetId); // Hardcoded ID
        $foo->vflag = true; // TODO make private, use setter
        $em->persist($foo);
        $em->flush();

Afterwards, the "version" column in the DB for the row should be incremented, even though no "real" fields were changed:

UPDATE example SET version = version + 1 WHERE id = ? AND version = ?
Comment by Darien Hager [ 06/Apr/15 ]

Another possibility may be to implement this as a listener with the `onFlush` event, but even then the kind of configuration being done seems like it ought to be stored (and accessed) along with everything else, as opposed to living in its own config or doing a separate pass on the annotations/xml/etc.

Comment by Darien Hager [ 09/Apr/15 ]

Created a slightly different implementation and made a pull-request for visibility. Further comments should probably go to DDC-3681.





[DDC-3639] [GH-1349] Fix #1347 Created: 26/Mar/15  Updated: 27/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1349

Message:

This PR fixes #1347.



 Comments   
Comment by Doctrine Bot [ 27/Mar/15 ]

A related Github Pull-Request [GH-1349] was closed:
https://github.com/doctrine/doctrine2/pull/1349





[DDC-3638] [GH-1348] Doctrine mapping:import command Created: 25/Mar/15  Updated: 25/Mar/15  Resolved: 25/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of alirezarahmani:

Url: https://github.com/doctrine/doctrine2/pull/1348

Message:

Why I cannot find this command:

`` php app/console doctrine:mapping:import --force AcmeBlogBundle xml ``
[here](http://doctrine-orm.readthedocs.org/en/latest/reference/tools.html?highlight=command) I mean mapping:import command.

I already replace this command:

`` php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force ``
with

`` sudo vendor/bin/doctrine orm:convert-mapping xml '/var/www/html/laravel/package' --from-database --force ``
and worked well.



 Comments   
Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-1348] was assigned:
https://github.com/doctrine/doctrine2/pull/1348

Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-1348] was closed:
https://github.com/doctrine/doctrine2/pull/1348





[DDC-3637] [GH-1347] problem with LimitSubqueryOutputWalker when use InheritanceType Created: 25/Mar/15  Updated: 31/Mar/15  Resolved: 31/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: paginator

Issue Links:
Duplicate
duplicates DDC-3645 [GH-1353] Paginator fixes take3 Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of alexander-orabey:

Url: https://github.com/doctrine/doctrine2/pull/1347

Message:

When we use InheritanceType ("SINGLE_TABLE") catch exception that field in joined class does not exist in base class.



 Comments   
Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-1347] was labeled:
https://github.com/doctrine/doctrine2/pull/1347

Comment by Doctrine Bot [ 31/Mar/15 ]

A related Github Pull-Request [GH-1347] was closed:
https://github.com/doctrine/doctrine2/pull/1347

Comment by Marco Pivetta [ 31/Mar/15 ]

Merged into DDC-3645 ( PR #1353 )





[DDC-3636] cannot extend ClassMetadataFactory Created: 25/Mar/15  Updated: 25/Mar/15  Resolved: 25/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Jurj Alin Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

We cannot extend the `ClassMetadataFactory` because most of the members are private.
Use case:
I have to overwrite only the `getShortName` and because most are private i need to copy/paste all the other private methods in my extended class just to make it work



 Comments   
Comment by Marco Pivetta [ 25/Mar/15 ]

The class metadata factory is not designed to be extensible, as it is an internal doctrine component.

Comment by Jurj Alin [ 25/Mar/15 ]

i understand that, however we are talking about custom discriminator value, nothing else, for example if i have the entity Application\Entity\User as the discriminator, it will be converted to `user`. Thats what i'm trying to do, just to allow different discriminator generation

Comment by Marco Pivetta [ 25/Mar/15 ]

Can't this simply be fixed via explicit mapping or via an event handler?





[DDC-3635] QueryBuilder - INSTANCE OF with parameter not working Created: 24/Mar/15  Updated: 08/Apr/15

Status: Reopened
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Wouter Wiltenburg Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: binding, dql, parameter
Environment:

Zend Framework 2



 Description   

I use single table class inheritance.
When I write my INSTANCE OF clause in my QueryBuilder like this:

    $result = $this->createQueryBuilder('o')
        ->leftJoin('o.child', 'c')
        ->where('c INSTANCE OF :entity_class')
        ->setParameter('entity_class', 'My\Entity\Class')
        ->getQuery()
        ->getResult();

It does not work correctly. The problem seems to lie in the fact that the parameter is bound to the SQL query. So if I change the entity_class to the discriminator column name it works correctly.

So if the discriminator value for My\Entity\Class would be discriminator then this does work:

    $result = $this->createQueryBuilder('o')
        ->leftJoin('o.child', 'c')
        ->where('c INSTANCE OF :entity_class')
        ->setParameter('entity_class', 'discriminator')
        ->getQuery()
        ->getResult();

So the step for getting the discriminator column from the class name is missing and instead the class name is bound to the MySql query directly.



 Comments   
Comment by Guilherme Blanco [ 08/Apr/15 ]

INSTANCE OF expressions expect either their class names or their corresponding class metadata. This means the following examples are valid:

$qb->where('c INSTANCE OF My\Entity\Class');

// or

$qb
    ->where('c INSTANCE OF :param')
    ->setParameter('param', $em->getClassMetadata('My\Entity\Class'))
;

Assigning class name directly does not work.
Closing as invalid.

Comment by Marco Pivetta [ 08/Apr/15 ]

Re-opening. I think this is a documentation issue then, as http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#id2 says that the InstanceOfParameter accepts also an InputParameter

Comment by Guilherme Blanco [ 08/Apr/15 ]

Marco Pivetta And it does. However, the bound parameter must be a ClassMetadata.





[DDC-3634] [GH-1346] Fix: generated IDs are converted to integer Created: 23/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 1
Labels: autogeneration, autoincrement, big-integer, identifier


 Description   

This issue is created automatically through a Github pull request on behalf of pepakriz:

Url: https://github.com/doctrine/doctrine2/pull/1346

Message:

When I try to use type `bigint` and `@GeneratedValue` together, generated value is converted to integer.

See PHP documentation http://php.net/manual/en/language.types.array.php

> Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer.



 Comments   
Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1346] was merged:
https://github.com/doctrine/doctrine2/pull/1346

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1346] was assigned:
https://github.com/doctrine/doctrine2/pull/1346

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1346] was labeled:
https://github.com/doctrine/doctrine2/pull/1346





[DDC-3633] Schema creation problem on PostgreSQL Created: 22/Mar/15  Updated: 16/Apr/15  Resolved: 16/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Dmitry Korotovsky Assignee: Steve Müller
Resolution: Invalid Votes: 0
Labels: schematool


 Description   

Schema tool can't create correct schema on empty database in PostgreSQL:

$ php app/console doctrine:schema:create --env=test
ATTENTION: This operation should not be executed in a production environment.

Creating database schema...

[Doctrine\ORM\Tools\ToolsException]
Schema-Tool failed with Error 'An exception occurred while executing 'CREATE SCHEMA public':
SQLSTATE[42P06]: Duplicate schema: 7 ERROR: schema "public" already exists' while executing DDL: CREATE SCHEMA public






[DDC-3632] [GH-1345] Fix crashes in ConvertMappingCommand and GenerateEntitiesCommand... Created: 20/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: discriminator-map, inheritance, metadata, reflection


 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1345

Message:

... when using entities with joined table inheritance

ConvertMappingCommand and GenerateEntitiesCommand both use the DisconnectedClassMetadataFactory, which allows metadata manipulation without loading the associated classes. Commit a36bea broke these two commands by adding a bailout condition in ClassMetadataFactory::populateDiscriminatorValue which checks $metadata->reflClass->isAbstract(). If the DisconnectedClassMetadataFactory is being used, $metadata->reflClass will always be null, causing a fatal error, "Fatal error: Call to a member function isAbstract() on null".

This commit adds a check to see if $metadata->reflClass is set before checking isAbstract.



 Comments   
Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1345] was assigned:
https://github.com/doctrine/doctrine2/pull/1345

Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1345] was labeled:
https://github.com/doctrine/doctrine2/pull/1345

Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1345] was labeled:
https://github.com/doctrine/doctrine2/pull/1345

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1345] was merged:
https://github.com/doctrine/doctrine2/pull/1345





[DDC-3631] [GH-1344] Fix tests for SLC console commands failing due to console output decoration Created: 20/Mar/15  Updated: 22/Mar/15  Resolved: 22/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Second Level Cache, Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: cache, console, second-level-cache, tools


 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1344

Message:

The tests for the SLC console commands were failing on my box because the console output was being decorated with ANSI color codes, while the test assertions were using undecorated strings.

This PR turns off output decoration when these console commands are executed in the tests.



 Comments   
Comment by Doctrine Bot [ 20/Mar/15 ]

A related Github Pull-Request [GH-1344] was merged:
https://github.com/doctrine/doctrine2/pull/1344

Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1344] was labeled:
https://github.com/doctrine/doctrine2/pull/1344

Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1344] was assigned:
https://github.com/doctrine/doctrine2/pull/1344





[DDC-3630] [GH-1343] Support embeddables in partial object query expression [DDC-3621] Created: 20/Mar/15  Updated: 25/Mar/15  Resolved: 23/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: dql, embeddables, hydration, partial

Issue Links:
Dependency
is required for DDC-3621 Support embeddables in partial object... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of karlrixon:

Url: https://github.com/doctrine/doctrine2/pull/1343

Message:

I don't see any existing tests covering this class, but all existing tests pass with this change.



 Comments   
Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1343] was labeled:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was labeled:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was assigned:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was merged:
https://github.com/doctrine/doctrine2/pull/1343





[DDC-3629] [GH-1342] Paginator functional tests Created: 19/Mar/15  Updated: 24/Mar/15  Resolved: 24/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: distinct, mssql, oracle, orderBy, orderby, paginator, postgresql

Issue Links:
Dependency
depends on DDC-3623 [GH-1337] Paginator OrderBy fix take 2 Resolved
is required for DDC-3606 [GH-1325] fixed PostgreSQL and Oracle... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1342

Message:

PaginationTest has been expanded and now covers ordering and limiting rather thoroughly.

4 tests fail on PostgreSQL and MySQL, 14 tests fail on SQL Server, and I didn't try any other DBMS.



 Comments   
Comment by Doctrine Bot [ 22/Mar/15 ]

A related Github Pull-Request [GH-1342] was labeled:
https://github.com/doctrine/doctrine2/pull/1342





[DDC-3628] Embeddable Array Hydration Issue Created: 19/Mar/15  Updated: 19/Mar/15  Resolved: 19/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: RJ Garcia Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: array, hydration, orm
Environment:

Mac OS X 10.10.2

PHP 5.6.6 (cli) (built: Mar 10 2015 14:21:21)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies


Attachments: File B5.Mdl.Bite5.CoverPhoto.CoverPhoto.dcm.yml     File B5.Mdl.Bite5.CoverPhoto.CoverPhotoCollection.dcm.yml    

 Description   

I've stumbled across the doctrine embeddable system, and it's been working great; however, I found an inconsistency with the array hydration.

Attached are my configuration files for my parent object and the embeddable. When doing a simple query to retrieve the parent object and use `getArrayResult`, I get the following data structure

[cover_photos] => Array
                (
                    [id] => ..
                    [url_key] => ...
                    [original.width] => ...
                    [original.height] => ...
                    [original.url] => ...
                    [original.type] => ..
                    [cropped.width] => ..
                    [cropped.height] => ..
                    ...
                )

This is inconsistent with how normal hydration works where the expected result would be something like

[coverphotos] => Array
    (
        [id] => ..
        [url_key] => ..
        [original] => Array
        (
           ...
        )
    )


 Comments   
Comment by Marco Pivetta [ 19/Mar/15 ]

This is actually expected behavior, IMO

Comment by Benjamin Eberlei [ 19/Mar/15 ]

Maybe we could document this, as it is a bit weird. But from my perspective this is ok as well. Everything else is very expensive to implement, not sure if its worth the benefit.

Comment by RJ Garcia [ 19/Mar/15 ]

Well, currently, I'm working around the issue with the following function

function array_expand(&$array, $separator = '.')
{
    $keys_to_recurse = [];
     foreach ($array as $key => $value) {
        $sep_position = strpos($key, $separator);

        if ($sep_position === false) {
            continue;
        }

        $prefix = substr($key, 0, $sep_position);
        $suffix = substr($key, $sep_position + 1);

        if (!array_key_exists($prefix, $array)) {
            $array[$prefix] = [];
            $keys_to_recurse[] = $prefix;
        }

        $array[$prefix][$suffix] = $value;
        unset($array[$key]);
     }

     foreach ($keys_to_recurse as $key) {
        array_expand($array[$key], $separator);
     }
}

Personally, as a user of this embeddable's feature, in my specific usage of the embeddables with array hydration, I need them in hierarchal format. I'm not too familiar with the hydration internals, so I can't comment on the difficulty of expanding the embeddable entities into structured hierarchal data

Comment by Marco Pivetta [ 19/Mar/15 ]

RJ Garcia is there any reason why you're using array hydration here?

Adding this change to the ArrayHydrator is actually problematic/complex (and a BC break now, since we froze 2.5.0-beta1 yesterday).

I would suggest keeping it out of the ORM.

Comment by RJ Garcia [ 19/Mar/15 ]

Yes, I was running into issues with prefetching in my query. Even though I had prefetched all of my desired associations, doctrine was still performing extra queries to load associations that I wasn't using/wanted. After I fetched my main entity collection, I needed to traverse it (perform some changes) and convert to arrays for outputting in a JSON api. When I traversed the object graph, doctrine would run queries on sub entities that I didn't want. When I switched to array hydration, naturally, I didn't get any of those extra queries when I traversed the array structure. I've also found better performance results when using array hydration, and because I'm only querying my entities to export them into JSON, I don't need full data/entity consistency.

Just recently, I stated using embeddables, and that's how I found out about the array hydration difference (because I was already using array hydration).

Comment by Marco Pivetta [ 19/Mar/15 ]

Resolving as won't fix since at this point, this is a BC break and is also quite complex/useless to solve from our perspective (we did have some internal discussion about it).





[DDC-3627] [GH-1341] [doc] Minor fixes and typos Created: 18/Mar/15  Updated: 18/Mar/15  Resolved: 18/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, typo


 Description   

This issue is created automatically through a Github pull request on behalf of javiereguiluz:

Url: https://github.com/doctrine/doctrine2/pull/1341

Message:



 Comments   
Comment by Doctrine Bot [ 18/Mar/15 ]

A related Github Pull-Request [GH-1341] was assigned:
https://github.com/doctrine/doctrine2/pull/1341

Comment by Doctrine Bot [ 18/Mar/15 ]

A related Github Pull-Request [GH-1341] was merged:
https://github.com/doctrine/doctrine2/pull/1341





[DDC-3626] [GH-1340] Add inversed by annotations on auto generate entities Created: 18/Mar/15  Updated: 23/Mar/15  Resolved: 23/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: bidirectional, entityGenerator


 Description   

This issue is created automatically through a Github pull request on behalf of luizkim:

Url: https://github.com/doctrine/doctrine2/pull/1340

Message:

Add inversed by annotations on auto generate entities.

Source:
http://w3facility.org/question/symfony2-doctrine2-generate-one-to-many-annotation-from-existing-database-by-doctrinemappingimport/#answer-17881139



 Comments   
Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1340] was closed:
https://github.com/doctrine/doctrine2/pull/1340





[DDC-3625] [GH-1339] [DDC-2224] Honor convertToDatabaseValueSQL() in DQL query parameters Created: 18/Mar/15  Updated: 25/Mar/15  Resolved: 25/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: cache, dql, parameter

Issue Links:
Dependency
is required for DDC-2224 convertToDatabaseValueSQL() is not ho... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/doctrine2/pull/1339

Message:

This is a follow-up to the abandoned #574 by @mnapoli, that fixes DDC-2224(http://www.doctrine-project.org/jira/browse/DDC-2224).

At the time, @beberlei closed the PR for the following reason, deemed unfixable:

> Passing a type into the parameters is not recognized during caching, that means, using a DQL cache, the same DQL statement with (different parameter types) will lead to the same SQL being generated, depending on if the first or the second set parameter query is executed first.

This PR re-integrates the original fix, and offers a solution to the above issue: take the parameter types into account when checking the local `ParserResult` and the query cache.

In addition to the test for the DDC-2224 issue, I added a test to ensure that changing a parameter type invalidates the cache.



 Comments   
Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1339] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1339

Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-1339] was assigned:
https://github.com/doctrine/doctrine2/pull/1339

Comment by Doctrine Bot [ 25/Mar/15 ]

A related Github Pull-Request [GH-1339] was merged:
https://github.com/doctrine/doctrine2/pull/1339





[DDC-3624] [GH-1338] [DDC-3619] Update identityMap when entity gets managed again Created: 17/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: 2.5, 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: garbage-collection, identity-map, object-hash, persist, remove, unitofwork

Issue Links:
Dependency
is required for DDC-3619 spl_object_hash collision Resolved
Reference
relates to DDC-3619 spl_object_hash collision Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of nclavaud:

Url: https://github.com/doctrine/doctrine2/pull/1338

Message:

http://www.doctrine-project.org/jira/browse/DDC-3619

When using SoftDeleteable doctrine extension, an entity can be scheduled
for deletion, then persisted before flushing. In such a case, the entity
was removed from the unit of work identity map and no reference was
hold. This could lead to spl_object_hash collisions, and prevent
another, new entity to be persisted later.

This fix makes sure the unit of work identity map holds a reference to
the entity after it has been soft-deleted.



 Comments   
Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1338] was assigned:
https://github.com/doctrine/doctrine2/pull/1338

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1338] was labeled:
https://github.com/doctrine/doctrine2/pull/1338

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1338] was closed:
https://github.com/doctrine/doctrine2/pull/1338





[DDC-3623] [GH-1337] Paginator OrderBy fix take 2 Created: 17/Mar/15  Updated: 24/Mar/15  Resolved: 24/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: distinct, mssql, oracle, orderBy, paginator, postgresql

Issue Links:
Dependency
is required for DDC-3606 [GH-1325] fixed PostgreSQL and Oracle... Resolved
is required for DDC-3629 [GH-1342] Paginator functional tests Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of zeroedin-bill:

Url: https://github.com/doctrine/doctrine2/pull/1337

Message:

This PR fixes issues created in #1220, reported in #1267. The original PR was reverted in #1283.

The issue was that in queries ordered by joined association columns, the joined column aliases did not exist in the outer query created in LimitSubqueryOutputWalker.

This PR adds functionality to LimitSubqueryOutputWalker which finds any such columns referenced in the OrderBy clause, and adds them to the SelectStatement prior to SQL generation.



 Comments   
Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1337] was labeled:
https://github.com/doctrine/doctrine2/pull/1337

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1337] was labeled:
https://github.com/doctrine/doctrine2/pull/1337

Comment by Doctrine Bot [ 24/Mar/15 ]

A related Github Pull-Request [GH-1337] was assigned:
https://github.com/doctrine/doctrine2/pull/1337





[DDC-3622] [GH-1336] Fix UoW warning with custom id object types Created: 17/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Critical
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: custom-dbal-type, identifier, identity, identity-map, object, string-cast


 Description   

This issue is created automatically through a Github pull request on behalf of stefanotorresi:

Url: https://github.com/doctrine/doctrine2/pull/1336

Message:

`UnitOfWork::tryGetById()` and `UnitOfWork::tryGetByIdHash()` may receive an object as an id, for instance when using a custom id type like [Rhumsaa\Uuid](https://github.com/ramsey/uuid/blob/2.8.0/src/Doctrine/UuidType.php).

This PR adds a simple cast to string in these methods.

There are a couple of things I'm not sure about, tho.

First of all, I don't know if functional tests alone are deemed sufficient, but I couldn't figure out how to replicate the issue via unit tests only (apart from directly invoking the two methods above with an object as argument, which looks a bit pointless).

Furthermore, I don't know if the cast should be applied elsewhere; so far the only cases I stumbled upon where common find and fetch joins, but I saw other methods where it may be necessary (i.e. [here](https://github.com/doctrine/doctrine2/blob/878f2455eee79f1573d2bb1f8c01be93f758779b/lib/Doctrine/ORM/UnitOfWork.php#L1559) and [here](https://github.com/doctrine/doctrine2/blob/878f2455eee79f1573d2bb1f8c01be93f758779b/lib/Doctrine/ORM/UnitOfWork.php#L1625)), but I couldn't replicate the code path to reach those.
Also I wonder if an exception should be thrown if the id object doesn't implement `__toString()`, and in this case if the fix should be refactored into `Doctrine\ORM\Utility\IdentifierFlattener`, for a bit of SoC.

Let me know what you think.



 Comments   
Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1336] was closed:
https://github.com/doctrine/doctrine2/pull/1336





[DDC-3621] Support embeddables in partial object query Created: 17/Mar/15  Updated: 25/Mar/15  Resolved: 23/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Karl Rixon Assignee: Guilherme Blanco
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Dependency
depends on DDC-3630 [GH-1343] Support embeddables in part... Resolved

 Description   

Hi,

Currently it's not possible to combine embeddables and partial objects - for example:

SELECT PARTIAL u.{id, name.first, name.last} FROM User

This results in an exception from the parser.

Is this just as simple as making the following change to Parser::PartialObjectExpression() line 1782?

// before
$partialFieldSet[] = $this->lexer->token['value'];

// after
$field = $this->lexer->token['value'];

while ($this->lexer->isNextToken(Lexer::T_DOT)) {
    $this->match(Lexer::T_DOT);
    $this->match(Lexer::T_IDENTIFIER);
    $field .= '.'.$this->lexer->token['value'];
}

$partialFieldSet[] = $field;


 Comments   
Comment by Karl Rixon [ 23/Mar/15 ]

doctrinebot automatically opened DDC-3621 when I issued a PR, so closing this issue as a duplicate.

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was labeled:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was assigned:
https://github.com/doctrine/doctrine2/pull/1343

Comment by Doctrine Bot [ 23/Mar/15 ]

A related Github Pull-Request [GH-1343] was merged:
https://github.com/doctrine/doctrine2/pull/1343





[DDC-3620] [GH-1335] Fix AbstractQuery::getParameter() documented return type Created: 17/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, DQL
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: docblock, dql, parameter, query, return-type


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/doctrine2/pull/1335

Message:

[As documented](https://github.com/doctrine/doctrine2/blob/master/UPGRADE.md#query-querybuilder-and-nativequery-parameters-bc-break), `getParameter()` always returns a `Query\Parameter` (or `NULL`).



 Comments   
Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1335] was assigned:
https://github.com/doctrine/doctrine2/pull/1335

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1335] was merged:
https://github.com/doctrine/doctrine2/pull/1335





[DDC-3619] spl_object_hash collision Created: 17/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: 2.5, 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Aleksandr Khristenko Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: garbage-collection, identity-map, object-hash, persist, remove, unitofwork

Attachments: File DDC3619Test.php    
Issue Links:
Dependency
depends on DDC-3624 [GH-1338] [DDC-3619] Update identityM... Resolved
Reference
is referenced by DDC-3624 [GH-1338] [DDC-3619] Update identityM... Resolved

 Description   

The code below demonstrate problem.

$user = $entityManager->find(User::class, $id); // get entity from db
$entityManager->remove($user); // remove user
$entityManager->persist($user); // cancel remove
unset($user);
/* at this moment spl_object_hash($user) is presented in the UoW, but the $user isn't presented in the identity map in UoW */
$user2 = new User(); // spl_object_hash($user2) may be equal to spl_object_hash($user) because $user has no reference
$entityManager->persist($user2);
$entityManager->flush(); //$user2 will not be saved, because UoW think, that is already exists


 Comments   
Comment by Marco Pivetta [ 17/Mar/15 ]

spl_object_hash($user2) may be equal to spl_object_hash($user) because $user has no reference

this seems wrong, since $user won't get garbage collected

Comment by Aleksandr Khristenko [ 17/Mar/15 ]

Why? The $user has no reference to it, so it may be collected.
I use SoftDeleteabale extension and faced with this problem.
My code is look like:

function delete($id) {
  $entity = $entityManager->find(Entity::class, $id);
  $entityManager->delete($entity); // the softdeleteable extension call persist($entity) and remove $entity from sheduledForDeletion in onFlush
  $entityManager->flush($entity);
} // after this function the UoW contains spl_object_hash($entity), but not contains $entity. After leave function $entity collected.
function createAnother() {
  $anotherEntity = new AnotherEntity();
  $entityManager->persist($anotherEntity);
  $entityManager->flush($anotherEntity); // there is a spl_object_hash collision and the entity is not saved
}
function main() {
  //...
  delete($id);
  //...
  createAnother();
}
Comment by Marco Pivetta [ 17/Mar/15 ]

Aleksandr Khristenko the UoW has an internal reference to $user, so it cannot be garbage collected

Comment by Marco Pivetta [ 17/Mar/15 ]

I suggest abstracting this problem into a test case in order to remove these doubts upfront.

Comment by Aleksandr Khristenko [ 17/Mar/15 ]

Aleksandr Khristenko the UoW has an internal reference to $user, so it cannot be garbage collected

Yes, but when we call remove($entity) this internal reference move from identityMap to entityDeletions array. And when we after that call persist($entity) this internal reference remove from entityDeletions array but NOT added to identityMap. So, after that UoW has not an internal reference to $user.

Comment by Aleksandr Khristenko [ 17/Mar/15 ]

I attached the test, which demonstrates that reference to entity from UoW is lost.

Comment by Nicolas [ 17/Mar/15 ]

I am also using SoftDeleteable Doctrine extension (https://github.com/Atlantic18/DoctrineExtensions) and facing a similar issue.

My scenario is:

  • fetch 2 entities from db ;
  • soft-delete these 2 entities (then flush) ;
  • create 3 new entities and persist them (then flush).

Problem is: 1 of the 3 entities won't be persisted (same $oid than one of the soft-deleted ones).

I've created a PR here that solves my issue:
https://github.com/doctrine/doctrine2/pull/1338

Does it make sense to you?

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1338] was closed:
https://github.com/doctrine/doctrine2/pull/1338





[DDC-3618] Refactor PersistentCollection Created: 16/Mar/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.5
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Varga Bence Assignee: Guilherme Blanco
Resolution: Unresolved Votes: 0
Labels: collection, orm


 Description   

PersistentCollection - a final class - contains all the metadata, used to speed up updates (through $snapshot). This information should be removed from the collection object and stored elsewhere, loosely coupled.

Doctrine2 uses the data mapper pattern (instead of Doctrine1's active record approach). This tells me that the designers see the importance of freedom which comes with loose coupling. Entities don't have to extend fixed base classes, why do collections?

Use case: I would like to use a wrapper around Collection (my current environment requires collections to have a certain functionality). This is possible in theory, but as I do the first step I'm losing all the advantages coming with PersistentColelction. Since it is a final class and logically an interface by itself (see the sniffing in ObjectHydrator#initRelatedCollection) it is impossible to create a wrapper which exposes the same functionality.

A short-term solution would be to extract an interface from PersistentColelction. A long-term one would be to manage the persisted state (currently PersistentCollection#snapshot) elsewhere (accessed through the EntityManager maybe).






[DDC-3617] [GH-1334] Changed some wrong usage of the @internal phpdoc Created: 15/Mar/15  Updated: 15/Mar/15  Resolved: 15/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: annotation, docblock, internal


 Description   

This issue is created automatically through a Github pull request on behalf of acrobat:

Url: https://github.com/doctrine/doctrine2/pull/1334

Message:

With this PR I removed/moved some @internal phpdocs as they weren't "real" internal tags, but more like internal info which ocramius and beberlei pointed out to me on the IRC channel. The use of the @internal phpdoc shows in IDE's as if the method/class should not be used and that's not true is most of the cases



 Comments   
Comment by Doctrine Bot [ 15/Mar/15 ]

A related Github Pull-Request [GH-1334] was assigned:
https://github.com/doctrine/doctrine2/pull/1334

Comment by Doctrine Bot [ 15/Mar/15 ]

A related Github Pull-Request [GH-1334] was labeled:
https://github.com/doctrine/doctrine2/pull/1334

Comment by Doctrine Bot [ 15/Mar/15 ]

A related Github Pull-Request [GH-1334] was merged:
https://github.com/doctrine/doctrine2/pull/1334





[DDC-3616] [GH-1333] Allow DateTimeImmutable as parameter value Created: 15/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: datetime, datetimeimmutable, datetimeinterface, dql, parameter, parameters, php-5.5


 Description   

This issue is created automatically through a Github pull request on behalf of janlanger:

Url: https://github.com/doctrine/doctrine2/pull/1333

Message:

This pull request allows passing instance of DateTimeImmutable as value to `setParameter` and its correct formating in query.



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1333] was labeled:
https://github.com/doctrine/doctrine2/pull/1333

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1333] was assigned:
https://github.com/doctrine/doctrine2/pull/1333

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1333] was labeled:
https://github.com/doctrine/doctrine2/pull/1333

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1333] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1333





[DDC-3615] [GH-1332] [Small Enhancement] Make scalar field separator overwritable Created: 13/Mar/15  Updated: 13/Mar/15  Resolved: 13/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Won't Fix Votes: 0
Labels: alias, dql, extensibility, hydrator


 Description   

This issue is created automatically through a Github pull request on behalf of eliecharra:

Url: https://github.com/doctrine/doctrine2/pull/1332

Message:

I would like to have a custom Hydrator extending ScalarHydrator just to change field separator ('_'), but I dont want to overwrite all method.
It's not very risky to make it extensible.



 Comments   
Comment by Doctrine Bot [ 13/Mar/15 ]

A related Github Pull-Request [GH-1332] was closed:
https://github.com/doctrine/doctrine2/pull/1332

Comment by Doctrine Bot [ 13/Mar/15 ]

A related Github Pull-Request [GH-1332] was assigned:
https://github.com/doctrine/doctrine2/pull/1332





[DDC-3614] [GH-1331] [DOCS] Fixed class name in aggregate fields example Created: 12/Mar/15  Updated: 12/Mar/15  Resolved: 12/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, embeddables


 Description   

This issue is created automatically through a Github pull request on behalf of 1ed:

Url: https://github.com/doctrine/doctrine2/pull/1331

Message:



 Comments   
Comment by Doctrine Bot [ 12/Mar/15 ]

A related Github Pull-Request [GH-1331] was assigned:
https://github.com/doctrine/doctrine2/pull/1331

Comment by Doctrine Bot [ 12/Mar/15 ]

A related Github Pull-Request [GH-1331] was merged:
https://github.com/doctrine/doctrine2/pull/1331





[DDC-3613] [GH-1330] Fix @Column options sections in documentation Created: 12/Mar/15  Updated: 12/Mar/15  Resolved: 12/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, Mapping Drivers
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: annotation, collate, column, documentation, metadata, schema, schema-tool


 Description   

This issue is created automatically through a Github pull request on behalf of coolmic:

Url: https://github.com/doctrine/doctrine2/pull/1330

Message:

I lose hours to find out how to make column collation works, mostly because of incorrect docs.

Annotations options is the equivalent of customSchemaOptions in https://github.com/doctrine/dbal/blob/master/docs/en/reference/schema-representation.rst

See https://github.com/doctrine/doctrine2/blob/d1e5034659e7beeb11830417a4a38de6586fe960/lib/Doctrine/ORM/Tools/SchemaTool.php#L443



 Comments   
Comment by Doctrine Bot [ 12/Mar/15 ]

A related Github Pull-Request [GH-1330] was assigned:
https://github.com/doctrine/doctrine2/pull/1330

Comment by Doctrine Bot [ 12/Mar/15 ]

A related Github Pull-Request [GH-1330] was merged:
https://github.com/doctrine/doctrine2/pull/1330





[DDC-3612] Make SQLFilter#em protected Created: 11/Mar/15  Updated: 11/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Evan Owens Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

SQLFilter#em is private, which can be troublesome when extending SQLFilter. I notice, for example, that the Gedmo SoftDeleteableFilter goes to the trouble of using reflection to get access to SoftDeleteableFilter#em.






[DDC-3611] [GH-1329] Fix for inconsistent use of getSQLDeclaration Created: 11/Mar/15  Updated: 13/Mar/15  Resolved: 13/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: case-sensitivity, documentation, type, typo


 Description   

This issue is created automatically through a Github pull request on behalf of Wilt:

Url: https://github.com/doctrine/doctrine2/pull/1329

Message:

I found an inconsistency in naming of the getSQLDeclaration method
I changed in 5 files `getSqlDeclaration` -> `getSQLDeclaration`



 Comments   
Comment by Doctrine Bot [ 13/Mar/15 ]

A related Github Pull-Request [GH-1329] was assigned:
https://github.com/doctrine/doctrine2/pull/1329

Comment by Doctrine Bot [ 13/Mar/15 ]

A related Github Pull-Request [GH-1329] was merged:
https://github.com/doctrine/doctrine2/pull/1329





[DDC-3610] [GH-1328] [DDC-3609] Syntax error in class table inheritance join when WITH is used in DQL query Created: 10/Mar/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of adeanzan:

Url: https://github.com/doctrine/doctrine2/pull/1328

Message:

I've added a test case to reproduce this issue. It's a bit contrived, but hopefully gives you enough to go on.



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1328] was labeled:
https://github.com/doctrine/doctrine2/pull/1328





[DDC-3609] Syntax error in class table inheritance join when WITH is used in DQL query Created: 10/Mar/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Alex Dean Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When using WITH on entities that use class table inheritance I'm seeing a syntax error in the generated SQL. Two "ON" statements show up:

INNER JOIN DDCNEWOrder d4_ ON d3_.id = d4_.id ON (d4_.id = d0_.id)

PR: https://github.com/doctrine/doctrine2/pull/1328



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1328] was labeled:
https://github.com/doctrine/doctrine2/pull/1328





[DDC-3608] [GH-1327] Properly generate default value from yml & xml mapping Created: 10/Mar/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, Tools
Affects Version/s: 2.4.7
Fix Version/s: 2.5, 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 1
Labels: default, entityGenerator, metadata

Issue Links:
Reference
is referenced by DDC-2809 [GH-853] Fix for PHP entity default v... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of j0k3r:

Url: https://github.com/doctrine/doctrine2/pull/1327

Message:

Yaml & Xml mapping which define default value for a field aren't properly generated in the entity class by the `EntityGenerator`.

This is how the documentation says to define a default value in [xml](http://doctrine-orm.readthedocs.org/en/latest/reference/xml-mapping.html):

```xml
<field name="login_count" type="integer" nullable="false">
<options>
<option name="default">0</option>
</options>
</field>
```

and in [yml](http://doctrine-orm.readthedocs.org/en/latest/reference/yaml-mapping.html):

```yaml
loginCount:
type: integer
column: login_count
nullable: false
options:
default: 0
```

Both generates this field mapping (aka `$fieldMapping`):

```php
array(5) {
'fieldName' =>
string(11) "login_count"
'type' =>
string(7) "integer"
'nullable' =>
bool(false)
'options' =>
array(1)

{ 'default' => string(1) "0" }

'columnName' =>
string(11) "login_count"
}
```

But the `EntityGenerator` check the default value in the wrong place, in `$fieldMapping['default']` instead of `$fieldMapping['options']['default']`.

This is related to :



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1327] was labeled:
https://github.com/doctrine/doctrine2/pull/1327

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1327] was assigned:
https://github.com/doctrine/doctrine2/pull/1327

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1327] was closed:
https://github.com/doctrine/doctrine2/pull/1327





[DDC-3607] [GH-1326] Allow AssociationBuilder to set a relation as orphan removal Created: 09/Mar/15  Updated: 09/Mar/15  Resolved: 09/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: association, association-builder, mapping, orphanRemoval, php-mapping


 Description   

This issue is created automatically through a Github pull request on behalf of guiwoda:

Url: https://github.com/doctrine/doctrine2/pull/1326

Message:

The AssociationBuilder, part of the StaticPHP metadata driver, is missing the orphanRemoval functionality.

I know we are in the middle of 2.5 release, so let me know if you need anything from this one when you've got time for it :smile:



 Comments   
Comment by Doctrine Bot [ 09/Mar/15 ]

A related Github Pull-Request [GH-1326] was assigned:
https://github.com/doctrine/doctrine2/pull/1326

Comment by Doctrine Bot [ 09/Mar/15 ]

A related Github Pull-Request [GH-1326] was merged:
https://github.com/doctrine/doctrine2/pull/1326





[DDC-3606] [GH-1325] fixed PostgreSQL and Oracle pagination issues Created: 09/Mar/15  Updated: 24/Mar/15  Resolved: 24/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 1
Labels: distinct, mssql, orderBy, paginator, postgresql

Issue Links:
Dependency
depends on DDC-3623 [GH-1337] Paginator OrderBy fix take 2 Resolved
depends on DDC-3629 [GH-1342] Paginator functional tests Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of vaheshadunts:

Url: https://github.com/doctrine/doctrine2/pull/1325

Message:

Pagination with ordering on 1:m and m:m relations, was not working
properly because of selecting the ordered fields in main select
statement with distinction (e.g. SELECT DISTINCT e0_.id, p1_.name from
... ) in this case we've received less rows than we've required in
query. So I've modified the subquery generation part.
In case of PostgreSQL and Oracle added the row_number in the subquery
over order by statement, then the main select is grouped by id and
selected min of row number, also ordering by rownumber asc, because they
are on right order already (e.g. select e0_.id, min(rownum) as rownum
from ..... order by rownum).
In case of MySQL, the subselect result with ids are in right order so
there is no need to select that fields(this fixes the same issue too)
In other cases I haven't tested because of that leaved the same.



 Comments   
Comment by Vahe Shadunts [ 09/Mar/15 ]

Hi Benjamin Eberlei, please let me know if I need to change something, I've used regular expression to change the doctrine's generated select statement, if there is a better way please let me know.

The code I've modified
https://github.com/vaheshadunts/doctrine2/blob/DDC-1958/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php#L221

Comment by Vahe Shadunts [ 09/Mar/15 ]

Also please let me know should I have to modify the test assertions of the queries which are have changed by my modifications? Or I have to skip the continuous integration ?

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1325] was labeled:
https://github.com/doctrine/doctrine2/pull/1325

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1325] was labeled:
https://github.com/doctrine/doctrine2/pull/1325

Comment by Doctrine Bot [ 24/Mar/15 ]

A related Github Pull-Request [GH-1325] was assigned:
https://github.com/doctrine/doctrine2/pull/1325

Comment by Doctrine Bot [ 24/Mar/15 ]

A related Github Pull-Request [GH-1325] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1325





[DDC-3605] [GH-1324] load all many to many join columns Created: 08/Mar/15  Updated: 10/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of fabiocarneiro:

Url: https://github.com/doctrine/doctrine2/pull/1324

Message:

the ```$joinColumnElement``` variable is created inside the foreach loop, and used only after it finishes, causing only the last join column to be loaded.



 Comments   
Comment by Doctrine Bot [ 10/Mar/15 ]

A related Github Pull-Request [GH-1324] was labeled:
https://github.com/doctrine/doctrine2/pull/1324

Comment by Doctrine Bot [ 10/Mar/15 ]

A related Github Pull-Request [GH-1324] was assigned:
https://github.com/doctrine/doctrine2/pull/1324





[DDC-3604] [GH-1323] - added isset validation for "inversedBy" Created: 08/Mar/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of kokspflanze:

Url: https://github.com/doctrine/doctrine2/pull/1323

Message:



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1323] was labeled:
https://github.com/doctrine/doctrine2/pull/1323

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1323] was labeled:
https://github.com/doctrine/doctrine2/pull/1323





[DDC-3603] Readonly columns Created: 06/Mar/15  Updated: 06/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Przemyslaw Wrobel Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Sometimes I have a column that is calculated (or have a default value) at the database side. When inserting a new record doctrine issues NULL into such a column that causes problems on some DBMS. I would like to annotate such columns as readonly so that doctrine would skip them in INSERT and UPDATE clauses but still fetch them in SELECT clauses.






[DDC-3602] allow regex in filter option for convert-mapping cli Created: 05/Mar/15  Updated: 05/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Jochem Blok Assignee: Steve Müller
Resolution: Unresolved Votes: 0
Labels: cli, convert-mapping, filter


 Description   

It is possible to use the filter option to filter which table is converted. It uses as strpos function of php. Please enable the power of regular expressions.






[DDC-3601] @index where annotation not filled with convert-mapping cli Created: 05/Mar/15  Updated: 05/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Jochem Blok Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: annotation, cli, convert-mapping, index, mssql, sqlserver
Environment:

Sql Server



 Description   

When you use the CLI tool "orm:convert-mapping --from-database xml" the generated XML file does not contain the optional WHERE for the indexes. It look like this is not implemented in de Doctrine\ORM\Tools\Export\Driver\XmlExporter






[DDC-3600] Implement include columns annotation for indexes Created: 05/Mar/15  Updated: 05/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Jochem Blok Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: annotation, index, mssql, sqlserver
Environment:

Sql Server



 Description   

Sql server has an option to include columns in an index. There is no (optional) annotation for this functionality. http://doctrine-orm.readthedocs.org/en/latest/reference/annotations-reference.html#annref-index



 Comments   
Comment by Marco Pivetta [ 05/Mar/15 ]

Why would you need this sort of feature, when an index already defines the included columns?

Comment by Jochem Blok [ 05/Mar/15 ]

the advantages are described on the MSDN website:

By including nonkey columns, you can create nonclustered indexes that cover more queries. This is because the nonkey columns have the following benefits:
They can be data types not allowed as index key columns.
They are not considered by the Database Engine when calculating the number of index key columns or index key size.





[DDC-3599] [GH-1322] Typo in documentation Created: 03/Mar/15  Updated: 04/Mar/15  Resolved: 04/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, typo


 Description   

This issue is created automatically through a Github pull request on behalf of dennisbirkholz:

Url: https://github.com/doctrine/doctrine2/pull/1322

Message:

Two list items where just one



 Comments   
Comment by Doctrine Bot [ 04/Mar/15 ]

A related Github Pull-Request [GH-1322] was assigned:
https://github.com/doctrine/doctrine2/pull/1322

Comment by Doctrine Bot [ 04/Mar/15 ]

A related Github Pull-Request [GH-1322] was merged:
https://github.com/doctrine/doctrine2/pull/1322





[DDC-3598] Paginator incorrect ordering Created: 03/Mar/15  Updated: 03/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Kris Assignee: Steve Müller
Resolution: Unresolved Votes: 0
Labels: paginator


 Description   

When ordering by multiple fields, with the order by fields not contained in the original select statement the paginator outputs in an incorrect order.
I found the issue is in the LimitSubqueryOutputWalker in the preserveSqlOrdering function. This is the query it generates

SELECT DISTINCT id1, date_added3 FROM (SELECT t0_.description AS description0, t0_.id AS id1, t0_.date AS date2, t0_.date_added AS date_added3 FROM Ticket t0_ INNER JOIN user u1_ ON t0_.assigned_user_id = u1_.id INNER JOIN user u2_ ON t0_.created_user_id = u2_.id WHERE t0_.project_id = ? ORDER BY u2_.first_name DESC, t0_.date_added DESC) dctrn_result ORDER BY date_added3 DESC

So it appears that it ignores any order by field that is not included in the inner select statement.






[DDC-3597] [GH-1321] embeddedClasses support in mapped superclasses Created: 03/Mar/15  Updated: 10/Mar/15  Resolved: 10/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: embeddables, inheritance, mappedsuperclass


 Description   

This issue is created to fixing this issue: https://github.com/doctrine/DoctrineModule/issues/481

Url: https://github.com/doctrine/doctrine2/pull/1321

Message:

...for JoinedSubclassPersister.php



 Comments   
Comment by Doctrine Bot [ 10/Mar/15 ]

A related Github Pull-Request [GH-1321] was assigned:
https://github.com/doctrine/doctrine2/pull/1321

Comment by Doctrine Bot [ 10/Mar/15 ]

A related Github Pull-Request [GH-1321] was merged:
https://github.com/doctrine/doctrine2/pull/1321

Comment by Doctrine Bot [ 10/Mar/15 ]

A related Github Pull-Request [GH-1321] was labeled:
https://github.com/doctrine/doctrine2/pull/1321





[DDC-3596] Do not allow entity column name "decimal" or escape somehow Created: 02/Mar/15  Updated: 08/Apr/15  Resolved: 08/Apr/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, Mapping Drivers, ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Aurimas Niekis Assignee: Guilherme Blanco
Resolution: Invalid Votes: 0
Labels: None


 Description   

Problem is that after creation and schema update of entity with property "decimal" it makes problem to insert and alter that column.

On schema update it uses this SQL to create table:

CREATE TABLE Unit (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, unit VARCHAR(255) NOT NULL, `decimal` SMALLINT NOT NULL, decimal_point VARCHAR(1) NOT NULL, thousands_separator VARCHAR(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;

When trying to persist entity I get exception

  [Doctrine\DBAL\DBALException]
  An exception occurred while executing 'INSERT INTO Unit (name, unit, decimal, decimal_point, thousands_separator) VALUES (?, ?, ?, ?, ?)' with params ["Cubic meters", "m\u00b3", "2", ".", ","]:
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'deci
  mal, decimal_point, thousands_separator) VALUES ('Cubic meters', 'm³', '2',' at line 1

Or alter table to rename column

  [Doctrine\DBAL\DBALException]
  An exception occurred while executing 'ALTER TABLE Unit CHANGE decimal decimal_numbers SMALLINT NOT NULL':
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'deci
  mal decimal_numbers SMALLINT NOT NULL' at line 1


 Comments   
Comment by Guilherme Blanco [ 08/Apr/15 ]

You missed to quote your columns to properly escape during column manipulation.
Closing as invalid.

Comment by Marco Pivetta [ 08/Apr/15 ]

Re-opening to remove resolution version





[DDC-3595] [GH-1320] Fix 'entitiy' typo in Getting Started tutorial Created: 02/Mar/15  Updated: 02/Mar/15  Resolved: 02/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, getting-started, typo


 Description   

This issue is created automatically through a Github pull request on behalf of joshdifabio:

Url: https://github.com/doctrine/doctrine2/pull/1320

Message:



 Comments   
Comment by Doctrine Bot [ 02/Mar/15 ]

A related Github Pull-Request [GH-1320] was assigned:
https://github.com/doctrine/doctrine2/pull/1320

Comment by Doctrine Bot [ 02/Mar/15 ]

A related Github Pull-Request [GH-1320] was merged:
https://github.com/doctrine/doctrine2/pull/1320





[DDC-3594] [GH-1319] travis: PHP 7.0 nightly added Created: 02/Mar/15  Updated: 11/Mar/15  Resolved: 11/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: ci, php-7.0, travis


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1319

Message:



 Comments   
Comment by Doctrine Bot [ 11/Mar/15 ]

A related Github Pull-Request [GH-1319] was assigned:
https://github.com/doctrine/doctrine2/pull/1319

Comment by Doctrine Bot [ 11/Mar/15 ]

A related Github Pull-Request [GH-1319] was merged:
https://github.com/doctrine/doctrine2/pull/1319





[DDC-3593] INDEX BY doesnt't work for NEW ArticleDTO Created: 01/Mar/15  Updated: 01/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Ondřej Vodáček Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

With this query the resulting array is not indexed by id, but from zero

Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$query = $em->createQuery('SELECT NEW ArticleDTO(a.id, a.title) FROM Article a INDEX BY a.id');
$articles = $query->getResult();





[DDC-3592] [GH-1318] Respect the "unique" property of the join column on the owning side of a... Created: 27/Feb/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Reference
relates to DDC-1666 orphanRemoval does not work with oneT... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of ed-at-work:

Url: https://github.com/doctrine/doctrine2/pull/1318

Message:

... One to One association. Coupled with Orphan Removal on the mapped side, this should provide better compatibility for replacing the row without getting duplicate key errors.



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1318] was labeled:
https://github.com/doctrine/doctrine2/pull/1318

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1318] was labeled:
https://github.com/doctrine/doctrine2/pull/1318





[DDC-3591] [GH-1317] Respect the "unique" property of the join column on the owning side of a... Created: 27/Feb/15  Updated: 27/Feb/15  Resolved: 27/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: join, metadata, one-to-one, unique


 Description   

This issue is created automatically through a Github pull request on behalf of ed-at-work:

Url: https://github.com/doctrine/doctrine2/pull/1317

Message:

... One to One association. Coupled with Orphan Removal on the mapped side, this should provide better compatibility for replacing the row without getting duplicate key errors.



 Comments   
Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1317] was closed:
https://github.com/doctrine/doctrine2/pull/1317





[DDC-3590] [GH-1316] Allow to join non-public schema tables Created: 26/Feb/15  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL, Mapping Drivers, ORM
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: join-table, mapping, naming-strategy, quoting, schema


 Description   

This issue is created automatically through a Github pull request on behalf of molchanoviv:

Url: https://github.com/doctrine/doctrine2/pull/1316

Message:

Fix joining non default schema tables in PostgreSQL



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1316] was labeled:
https://github.com/doctrine/doctrine2/pull/1316

Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1316] was assigned:
https://github.com/doctrine/doctrine2/pull/1316

Comment by Doctrine Bot [ 17/Mar/15 ]

A related Github Pull-Request [GH-1316] was closed:
https://github.com/doctrine/doctrine2/pull/1316





[DDC-3589] [GH-1315] Fixed broken url for implementing Serializable interface Created: 26/Feb/15  Updated: 26/Feb/15  Resolved: 26/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, link


 Description   

This issue is created automatically through a Github pull request on behalf of GeekMode:

Url: https://github.com/doctrine/doctrine2/pull/1315

Message:

Fixed a broken url for implementing the Serializable interface. The link was pointing to an outdated German version of php.net manual.



 Comments   
Comment by Doctrine Bot [ 26/Feb/15 ]

A related Github Pull-Request [GH-1315] was assigned:
https://github.com/doctrine/doctrine2/pull/1315

Comment by Doctrine Bot [ 26/Feb/15 ]

A related Github Pull-Request [GH-1315] was merged:
https://github.com/doctrine/doctrine2/pull/1315





[DDC-3588] [GH-1314] DATE_ADD - Support for seconds Created: 25/Feb/15  Updated: 26/Feb/15  Resolved: 26/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: custom-dql-function, date-diff, datetime, dql


 Description   

This issue is created automatically through a Github pull request on behalf of FabioBatSilva:

Url: https://github.com/doctrine/doctrine2/pull/1314

Message:



 Comments   
Comment by Doctrine Bot [ 26/Feb/15 ]

A related Github Pull-Request [GH-1314] was assigned:
https://github.com/doctrine/doctrine2/pull/1314

Comment by Doctrine Bot [ 26/Feb/15 ]

A related Github Pull-Request [GH-1314] was merged:
https://github.com/doctrine/doctrine2/pull/1314





[DDC-3587] [GH-1313] Added programmatical support to define indexBy on root aliases. Created: 25/Feb/15  Updated: 25/Feb/15  Resolved: 25/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: index-by, querybuilder


 Description   

This issue is created automatically through a Github pull request on behalf of guilhermeblanco:

Url: https://github.com/doctrine/doctrine2/pull/1313

Message:



 Comments   
Comment by Doctrine Bot [ 25/Feb/15 ]

A related Github Pull-Request [GH-1313] was assigned:
https://github.com/doctrine/doctrine2/pull/1313

Comment by Doctrine Bot [ 25/Feb/15 ]

A related Github Pull-Request [GH-1313] was merged:
https://github.com/doctrine/doctrine2/pull/1313





[DDC-3586] [GH-1312] Add proper pluralization into UpdateCommand Created: 24/Feb/15  Updated: 24/Feb/15  Resolved: 24/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of ThomasLomas:

Url: https://github.com/doctrine/doctrine2/pull/1312

Message:

This alters the UpdateCommand so that if only 1 query is was executed, it will say so.

Rather than "1 queries were executed"



 Comments   
Comment by Doctrine Bot [ 24/Feb/15 ]

A related Github Pull-Request [GH-1312] was merged:
https://github.com/doctrine/doctrine2/pull/1312

Comment by Doctrine Bot [ 24/Feb/15 ]

A related Github Pull-Request [GH-1312] was assigned:
https://github.com/doctrine/doctrine2/pull/1312





[DDC-3585] [GH-1311] [DDC-3582] Wrong class is instantiated when using nested embeddables Created: 24/Feb/15  Updated: 27/Feb/15  Resolved: 27/Feb/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: embeddables, orm


 Description   

This issue is created automatically through a Github pull request on behalf of jankramer:

Url: https://github.com/doctrine/doctrine2/pull/1311

Message:

Consider the example where an entity contains an embeddable, that itself contains 2 different embeddables. So Entity -> Embeddable 1 -> (Embeddable 2, Embeddable 3). In this case, EmbeddableContainer will be instantiated as an Embeddable1 for some reason.

I looked at the code in the ReflectionEmbeddedProperty, and noticed that 'embeddedClass' was recently changed from 'class'. If I change it back, this test passes, but then the ReflectionEmbeddedPropertyTest fails on the scenario for abstract classes.



 Comments   
Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1311] was assigned:
https://github.com/doctrine/doctrine2/pull/1311

Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1311] was merged:
https://github.com/doctrine/doctrine2/pull/1311





[DDC-3584] [GH-1310] Allow symfony 3.0 components Created: 22/Feb/15  Updated: 16/Mar/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of nicolas-grekas:

Url: https://github.com/doctrine/doctrine2/pull/1310

Message:

Tests should tell if any deprecated interfaces of Symfony are used. If not, then the bundle is defacto compatible with 3.0



 Comments   
Comment by Doctrine Bot [ 16/Mar/15 ]

A related Github Pull-Request [GH-1310] was labeled:
https://github.com/doctrine/doctrine2/pull/1310





[DDC-3583] [GH-1309] [DDC-3582] Fix hydration of nested embeddables Created: 22/Feb/15  Updated: 27/Feb/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of jankramer:

Url: https://github.com/doctrine/doctrine2/pull/1309

Message:

The wrong class is chosen when hydrating embeddables that are part of a nested structure. See `DDC3582Test` for a demonstration. The fix is to use `class` instead of `embeddedClass` to instantiate the embeddable in ReflectionEmbeddedProperty.

The test I removed from ReflectionEmbeddedPropertyTest was failing because you cannot instantiate an abstract class (and rightfully so). However, as this would not be possible in practice anyway (you always end up extending the abstract class), I think this test can be removed safely.



 Comments   
Comment by Doctrine Bot [ 22/Feb/15 ]

A related Github Pull-Request [GH-1309] was closed:
https://github.com/doctrine/doctrine2/pull/1309

Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1311] was assigned:
https://github.com/doctrine/doctrine2/pull/1311

Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1311] was merged:
https://github.com/doctrine/doctrine2/pull/1311





[DDC-3582] Nested embeddables are instantiated with the wrong class Created: 22/Feb/15  Updated: 27/Feb/15

Status: Reopened
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Jan Kramer Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Consider the example where an entity contains an embeddable, that itself contains 2 different embeddables. So Entity -> Embeddable 1 -> (Embeddable 2, Embeddable 3). In this case, Embeddable1 will be instantiated as an Embeddable2 for some reason.

Please see https://github.com/jankramer/doctrine2/commit/5e6b02a0fa9a1216b4e4d075061619288af74e7a for a test that demonstrates this and currently fails.

I looked at the code in the ReflectionEmbeddedProperty, and noticed that 'embeddedClass' was recently changed from 'class'. If I change it back, this test passes, but then the ReflectionEmbeddedPropertyTest fails on the scenario for abstract classes. @ocramius, I saw you were the author on that change, could you please take a look? Thanks!



 Comments   
Comment by Jan Kramer [ 22/Feb/15 ]

Closing this as I can't seem to reproduce this issue anymore.

Comment by Jan Kramer [ 24/Feb/15 ]

Now able to reproduce this issue, updated the description.

Comment by Marco Pivetta [ 24/Feb/15 ]

Jan Kramer please send a PR with that diff

Comment by Jan Kramer [ 24/Feb/15 ]

@ocramius See https://github.com/doctrine/doctrine2/pull/1311

Comment by Doctrine Bot [ 27/Feb/15 ]

A related Github Pull-Request [GH-1311] was assigned:
https://github.com/doctrine/doctrine2/pull/1311

Comment by Doctrine Bot [ 27/Feb/15 ]