[TYPO3-dev] Sorting of comma separated UIDs
Tobias Liebig
tobias.liebig at typo3.org
Sun Mar 4 12:18:31 CET 2012
Hej Bernd,
i had exactly the same problem a while ago. As extbase had no option for that yet i created an patch to use an custom ordering expression.
You might want to check and review: https://review.typo3.org/#/c/8619/
$query->setOrderings(
'FIELD(uid, "' . implode(',', $uids) . '")' => Tx_Extbase_Persistence_QueryInterface::ORDER_EXPRESSION
)
regards
Tobias
Am 03.03.2012 um 22:50 schrieb Bernd Schönbach:
> Hi,
>
> I have a flexform field, where an BE User can select fe_user entries to be displayed in the front end.
> The problem I am having is that the sorting of the flexform field is not respected in the front end output.
> Is there any native extbase way to do that?
>
> Greets
> Bernd
>
> Flexform Code:
> <settings.users>
> <TCEforms>
> <label>LLL:EXT:iccore/locallang_db.xml:tx_iccore.pi_flexform_users.users</label>
> <config>
> <type>select</type>
> <foreign_table>fe_users</foreign_table>
> <foreign_table_where>
> AND fe_users.usergroup = ###PAGE_TSCONFIG_ID###
> ORDER BY fe_users.name
> </foreign_table_where>
> <size>10</size>
> <minitems>0</minitems>
> <maxitems>9999</maxitems>
> </config>
> </TCEforms>
> </settings.users>
>
> Function:
> /**
> * Finds an object matching the given identifier.
> *
> * @param array $uid The identifier of the object to find
> * @return object The matching object if found, otherwise NULL
> */
> public function findByUidList($uids) {
> $query = $this->createQuery();
> $query->getQuerySettings()->setRespectSysLanguage(FALSE);
> $query->getQuerySettings()->setRespectStoragePage(FALSE);
> $object = $query
> ->matching(
> $query->in('uid', $uids)
> )
> ->execute();
> return $object;
> }
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
More information about the TYPO3-dev
mailing list