Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2093

Doctrine Criteria does not support sorting by relationed field

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      // Here I call Criteria filter
      public function getWalletsActive() {
      	$criteria = Criteria::create()
      		->where(Criteria::expr()->eq("isRemoved", "0"))
      		->orderBy(array("currency.id" => "ASC"));
      	return $this->wallets->matching($criteria);
      }
      
      // Relation
      /**
       * @var Currency
       *
       * @ORM\ManyToOne(targetEntity="Currency")
       * @ORM\JoinColumns({
       * @ORM\JoinColumn(name="id_currency", referencedColumnName="id")
       * })
       */
      protected $currency;
      
      // File BasicEntityPersister.php
      // This cause the problem:
      if ( ! isset($this->_class->fieldMappings[$fieldName])) {
          throw ORMException::unrecognizedField($fieldName);
      }
      // There are no relations in $this->_class->fieldMappings at all!
      

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Mark as improvement.

        Show
        Benjamin Eberlei added a comment - Mark as improvement.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Bogdan Yurov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: