CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #36575

Relation listSome does not respect limit settings (missing setLimit in Repository)

Added by Jörg Velletti about 1 year ago.

Status:New Start date:2012-04-25
Priority:Should have Due date:
Assignee:- % Done:

0%

Category:important tasks
Target version:First TER version
Votes: 0

Description

First one remark: hopefully next week i will find some time to setup gerrit that i can commit patches on my own ...

to solve this

Just change the findRelationsForUser function in ext/community/Classes/Domain/Repository/RelationRepository.php
As i set default limit to 0 and just add setLimit() to query if > than 0 , this should work also with existing installations.
(because actually the configuration for Limit is not set in setup.txt)

/** * Find confirmed relations for a certain user. * * @param Tx_Community_Domain_Model_User $user * @param integer $limit * @return Tx_Extbase_Persistence_QueryResultInterface *
/
public function findRelationsForUser(Tx_Community_Domain_Model_User $user
, $limit=0*) {
$query = $this->createQuery();
  • $limit = intval($limit);
    if ( $limit > 0) {
    $query->setLimit($limit) ;
    }*
    return $query->matching(
    $query->logicalAnd(
    $query->logicalOr(
    $query->equals('initiatingUser', $user),
    $query->equals('requestedUser', $user)
    ),
    $query->equals('status', Tx_Community_Domain_Model_Relation::RELATION_STATUS_CONFIRMED)
    )
    )->execute();
    }

Also available in: Atom PDF