DDC-3341: SessionValidator gives an error message on orderBy association, but it is no error. #4129

Closed
opened 2026-01-22 14:35:42 +01:00 by admin · 9 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 7, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user tobias93:

Originally created by @doctrinebot on GitHub (Oct 7, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user tobias93:
admin added the Bug label 2026-01-22 14:35:42 +01:00
admin closed this issue 2026-01-22 14:35:42 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 7, 2014):

Comment created by @ocramius:

[~tobias93] provide a failing test case to demonstrate the problem first

@doctrinebot commented on GitHub (Oct 7, 2014): Comment created by @ocramius: [~tobias93] provide a failing test case to demonstrate the problem first
Author
Owner

@doctrinebot commented on GitHub (Oct 7, 2014):

Comment created by tobias93:

Idb\TicketBundle\Entity\Ticket

namespace Idb\TicketBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

class Ticket {

  /****
   * @ORM\OneToMany(targetEntity="Idb\TicketBundle\Entity\TicketReservation", mappedBy="ticket", cascade={"persist","remove"})
   * @ORM\OrderBy({"ticketReservationType" = "ASC", "amount" = "DESC"})
   */
  private $ticketReservations;

}

Idb\TicketBundle\Entity\TicketReservation

namespace Idb\TicketBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

class TicketReservation {

  /****
   * @ORM\ManyToOne(targetEntity="Idb\TicketBundle\Entity\TicketReservationType")
   * @ORM\JoinColumn(name="ticketreservationtype_id", referencedColumnName="id")
   */
  private $ticketReservationType;

  /****
   * @var integer
   * @ORM\Column(name="amount", type="integer", nullable=false)
   */
  private $amount;

}

The orderBy on amount gives no error when validating the schema, the orderBy on ticketReservationType does (* The association Idb\TicketBundle\Entity\Ticket#ticketReservations is ordered by a foreign field ticketReservationType that is not a field on the target entity Idb\TicketBundle\Entity\TicketReservation).
However, the orderBy statement is not wrong as it is carried out perfectly when using the code.
The only problem is when validating.

@doctrinebot commented on GitHub (Oct 7, 2014): Comment created by tobias93: `Idb\TicketBundle\Entity\Ticket` ``` namespace Idb\TicketBundle\Entity; use Doctrine\ORM\Mapping as ORM; class Ticket { /**** * @ORM\OneToMany(targetEntity="Idb\TicketBundle\Entity\TicketReservation", mappedBy="ticket", cascade={"persist","remove"}) * @ORM\OrderBy({"ticketReservationType" = "ASC", "amount" = "DESC"}) */ private $ticketReservations; } ``` `Idb\TicketBundle\Entity\TicketReservation` ``` namespace Idb\TicketBundle\Entity; use Doctrine\ORM\Mapping as ORM; class TicketReservation { /**** * @ORM\ManyToOne(targetEntity="Idb\TicketBundle\Entity\TicketReservationType") * @ORM\JoinColumn(name="ticketreservationtype_id", referencedColumnName="id") */ private $ticketReservationType; /**** * @var integer * @ORM\Column(name="amount", type="integer", nullable=false) */ private $amount; } ``` The orderBy on amount gives no error when validating the schema, the orderBy on ticketReservationType does (`* The association Idb\TicketBundle\Entity\Ticket#ticketReservations is ordered by a foreign field ticketReservationType that is not a field on the target entity Idb\TicketBundle\Entity\TicketReservation`). However, the orderBy statement is not wrong as it is carried out perfectly when using the code. The only problem is when validating.
Author
Owner

@doctrinebot commented on GitHub (Oct 13, 2014):

Comment created by tobias93:

[~ocramius] Any progress on this one yet? Or do you need more information?

@doctrinebot commented on GitHub (Oct 13, 2014): Comment created by tobias93: [~ocramius] Any progress on this one yet? Or do you need more information?
Author
Owner

@doctrinebot commented on GitHub (Oct 13, 2014):

Comment created by @ocramius:

{quote}Any progress on this one yet?{quote}

No, no progress so far, and I can't allocate time for D2 over the next few weeks.
As for the information amount, it seems sufficient to me: we are probably just using field mappings without checking association mappings when looking for order fields. There is still a problem about what to do with composite identifiers or derived identifiers, but it should be covered by tests first.

@doctrinebot commented on GitHub (Oct 13, 2014): Comment created by @ocramius: {quote}Any progress on this one yet?{quote} No, no progress so far, and I can't allocate time for D2 over the next few weeks. As for the information amount, it seems sufficient to me: we are probably just using field mappings without checking association mappings when looking for order fields. There is still a problem about what to do with composite identifiers or derived identifiers, but it should be covered by tests first.
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2015):

Comment created by tobias93:

[~ocramius] I'm sorry for asking, but still no progress for this ticket? Any ETA? Half a year would be fine (for instance), just keep us up-to-date.

@doctrinebot commented on GitHub (Jan 24, 2015): Comment created by tobias93: [~ocramius] I'm sorry for asking, but still no progress for this ticket? Any ETA? Half a year would be fine (for instance), just keep us up-to-date.
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2015):

Comment created by @ocramius:

[~tobias93] I honestly worked on a load of other tickets, but not on this one.

If you want an ETA, start looking into it yourself, as I can't pack it into the 2.5 release myself due to time constraints.

@doctrinebot commented on GitHub (Jan 24, 2015): Comment created by @ocramius: [~tobias93] I honestly worked on a load of other tickets, but not on this one. If you want an ETA, start looking into it yourself, as I can't pack it into the 2.5 release myself due to time constraints.
Author
Owner

@doctrinebot commented on GitHub (Feb 24, 2015):

Comment created by tobias93:

Fixed in #1146, so can be closed.

@doctrinebot commented on GitHub (Feb 24, 2015): Comment created by tobias93: Fixed in [#1146](http://www.doctrine-project.org/jira/browse/[DDC-3322]%28http://www.doctrine-project.org/jira/browse/DDC-3322%29), so can be closed.
Author
Owner

@doctrinebot commented on GitHub (Feb 24, 2015):

Comment created by tobias93:

Fixed in #1149

@doctrinebot commented on GitHub (Feb 24, 2015): Comment created by tobias93: Fixed in [#1149](http://www.doctrine-project.org/jira/browse/[DDC-3322]%28http://www.doctrine-project.org/jira/browse/DDC-3322%29)
Author
Owner

@doctrinebot commented on GitHub (Feb 24, 2015):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Feb 24, 2015): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4129