Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
typo3.org
t3o_membership
Commits
5a886cd2
Commit
5a886cd2
authored
Jun 15, 2020
by
Marco Huber
Browse files
[TASK]
#37
- Firstname/Lastname search in memberlist
parent
655bd4e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Domain/Repository/MemberRepository.php
View file @
5a886cd2
<?php
namespace
T3o\T3oMembership\Domain\Repository
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Persistence\QueryInterface
;
use
TYPO3\CMS\Extbase\Persistence\QueryResultInterface
;
...
...
@@ -39,13 +40,23 @@ class MemberRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
$query
=
$this
->
createQuery
();
$constraints
=
[];
if
(
$filterString
)
{
$constraints
=
$query
->
logicalOr
(
[
$filterStringConstraints
=
[
$query
->
like
(
'name'
,
'%'
.
$filterString
.
'%'
),
$query
->
like
(
'firstname'
,
'%'
.
$filterString
.
'%'
),
$query
->
like
(
'lastname'
,
'%'
.
$filterString
.
'%'
),
]
);
];
list
(
$firstName
,
$lastName
)
=
GeneralUtility
::
trimExplode
(
' '
,
$filterString
);
if
(
strlen
(
$firstName
)
>
0
&&
strlen
(
$lastName
)
>
0
){
$filterStringConstraints
[]
=
$query
->
logicalAnd
(
[
$query
->
like
(
'firstname'
,
'%'
.
$firstName
.
'%'
),
$query
->
like
(
'lastname'
,
'%'
.
$lastName
.
'%'
),
]
);
}
$constraints
[]
=
$query
->
logicalOr
(
$filterStringConstraints
);
}
if
(
$filterMembership
)
{
$constraints
[]
=
$query
->
equals
(
'membership'
,
$filterMembership
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment