[TYPO3-dev] How to make Validation happy when returning QueryResult as Model Property
g4-lisz at tonarchiv.ch
g4-lisz at tonarchiv.ch
Fri Apr 24 00:53:50 CEST 2015
Hi there,
I know (once again...) that this is not the way to do things. But it's
the only way to get related objects ordered:
Repository:
public function findByStandort(Tx_Hplusinfo_Domain_Model_Klinik
$klinik) {
$query = $this->createQuery();
....
$query->setOrderings(array(
'sort' =>
Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
'foo' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
));
return $query->execute();
}
Model Class:
/**
* Returns the zerts
*
* @return Tx_Extbase_Persistence_ObjectStorage
*/
public function getZerts() {
$repository =
$this->objectManager->get('Tx_Myext_Domain_Repository_ZertRepository');
return $repository->findAndSortByXY($this);
}
This results in a "The given subject was not a collection" validation
error for ClassXY.zert. O.k. maybe it's not a collection, but it does
everything it needs to do...
To make the vailidator happy I could use return
$repository->findAndSortByXY($this)->toArray();
But this is not nice, neather.
Any idea?
Till
More information about the TYPO3-dev
mailing list