Skip to content

Loading…

DDC-2093: Doctrine Criteria does not support sorting by relationed field #2777

Open
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user nick4fake:

// 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!
@doctrinebot

Comment created by @beberlei:

Mark as improvement.

@doctrinebot

Comment created by liverbool:

How about this?

@doctrinebot

Comment created by @ocramius:

[~liverbool] give it a try and open a PR

@beberlei beberlei was assigned by doctrinebot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.