[TASK] Use fully qualified name resolution in PHP 5.5
[Packages/TYPO3.CMS.git] / typo3 / sysext / sys_note / Classes / Domain / Repository / SysNoteRepository.php
1 <?php
2 namespace TYPO3\CMS\SysNote\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 * Sys_note repository
19 *
20 * @author Georg Ringer <typo3@ringerge.org>
21 * @author Kai Vogel <kai.vogel@speedprogs.de>
22 */
23 class SysNoteRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
24
25 /**
26 * Initialize the repository
27 *
28 * @return void
29 */
30 public function initializeObject() {
31 $querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
32 $querySettings->setRespectStoragePage(FALSE);
33 $this->setDefaultQuerySettings($querySettings);
34 }
35
36 /**
37 * Find notes by given pids and author
38 *
39 * @param string $pids Single PID or comma separated list of PIDs
40 * @param \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author The author
41 * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
42 */
43 public function findByPidsAndAuthor($pids, \TYPO3\CMS\Extbase\Domain\Model\BackendUser $author) {
44 $pids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', (string)$pids);
45 $query = $this->createQuery();
46 $query->setOrderings(array(
47 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING,
48 'creationDate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
49 ));
50 $query->matching(
51 $query->logicalAnd(
52 $query->in('pid', $pids),
53 $query->logicalOr(
54 $query->equals('personal', 0),
55 $query->equals('author', $author)
56 )
57 )
58 );
59 return $query->execute();
60 }
61
62 }