|
1
|
|
|
<?php |
|
2
|
|
|
namespace EWW\Dpf\Domain\Repository; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* The repository for to be imported external metadata |
|
19
|
|
|
*/ |
|
20
|
|
|
class ExternalMetadataRepository extends \EWW\Dpf\Domain\Repository\AbstractRepository |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* Find external metadata by a frontend user uid and a publication identifier. |
|
24
|
|
|
* |
|
25
|
|
|
* @param int $feUser |
|
26
|
|
|
* @param string $identifier |
|
27
|
|
|
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
|
28
|
|
|
*/ |
|
29
|
|
|
public function findOneByUserAndPublicationIdentifier($feUser, $identifier) |
|
30
|
|
|
{ |
|
31
|
|
|
$query = $this->createQuery(); |
|
32
|
|
|
|
|
33
|
|
|
$constraints = array(); |
|
34
|
|
|
$constraints[] = $query->equals('publication_identifier', $identifier); |
|
35
|
|
|
$constraints[] = $query->equals('fe_user', $feUser); |
|
36
|
|
|
|
|
37
|
|
|
$query->matching($query->logicalAnd($constraints)); |
|
38
|
|
|
return $query->execute()->getFirst(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Deletes all stored external metadata of the given feUser. |
|
43
|
|
|
* |
|
44
|
|
|
* @param $feUserUid |
|
45
|
|
|
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException |
|
46
|
|
|
*/ |
|
47
|
|
|
public function clearExternalMetadataByFeUserUid($feUserUid) |
|
48
|
|
|
{ |
|
49
|
|
|
$metadata = $this->findByFeUser($feUserUid); |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
foreach ($metadata as $metadataItem) { |
|
52
|
|
|
$this->remove($metadataItem); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|