Commit ea0fd677 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch 'bugfix/search-for-personal-members-with-firstname-lastname' into 'master'

Add possibility to search for personal members (community, bronze)

See merge request t3o/t3o_membership!8
parents f4d05419 d4825a1a
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
/**
* Class \T3oMembership\Domain\Repository\MemberRepository
*
* @author Thomas Löffler <thomas.loeffler@typo3.org>
*/
class MemberRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
......@@ -27,23 +28,30 @@ class MemberRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
/**
* @var array
*/
protected $defaultOrderings = array(
protected $defaultOrderings = [
'membership.sorting' => QueryInterface::ORDER_ASCENDING,
'name' => QueryInterface::ORDER_ASCENDING
);
'name' => QueryInterface::ORDER_ASCENDING,
'lastname' => QueryInterface::ORDER_ASCENDING
];
/**
* @param string $filterString
* @param string $filterString
* @param integer $filterMembership
* @return QueryResultInterface
*/
public function findByStringAndMembership($filterString, $filterMembership)
{
$query = $this->createQuery();
$constraints = array();
$constraints = [];
if ($filterString) {
$filterString = $this->getDatabaseConnection()->escapeStrForLike($filterString, 'tx_t3omembership_domain_model_member');
$constraints[] = $query->like('name', '%' . $filterString . '%');
$constraints = $query->logicalOr(
[
$query->like('name', '%' . $filterString . '%'),
$query->like('firstname', '%' . $filterString . '%'),
$query->like('lastname', '%' . $filterString . '%'),
]
);
}
if ($filterMembership) {
$constraints[] = $query->equals('membership', $filterMembership);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment