[BUGFIX] FAL: Image Processing doesn't respect GFX "thumbnails_png"
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / FileCollectionRepository.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2011-2013 Andreas Wolf <andreas.wolf@ikt-werk.de>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * Repository for accessing the collections stored in the database
31 *
32 * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
33 * @author Ingmar Schlecht <ingmar@typo3.org>
34 */
35 class FileCollectionRepository extends \TYPO3\CMS\Core\Collection\RecordCollectionRepository {
36
37 /**
38 * @var string
39 */
40 protected $table = 'sys_file_collection';
41
42 /**
43 * @var string
44 */
45 protected $typeField = 'type';
46
47 /**
48 * Finds a record collection by uid.
49 *
50 * @todo the parent function throws already an exception if not found
51 * @param integer $uid The uid to be looked up
52 * @return NULL|Collection\AbstractFileCollection
53 * @throws \RuntimeException
54 */
55 public function findByUid($uid) {
56 $object = parent::findByUid($uid);
57 if ($object === NULL) {
58 throw new \RuntimeException('Could not find row with uid "' . $uid . '" in table "' . $this->table . '"', 1314354065);
59 }
60 return $object;
61 }
62
63 /**
64 * Creates a record collection domain object.
65 *
66 * @param array $record Database record to be reconsituted
67 *
68 * @return Collection\AbstractFileCollection
69 */
70 protected function createDomainObject(array $record) {
71 return $this->getFileFactory()->createCollectionObject($record);
72 }
73
74 /**
75 * Gets the file factory.
76 *
77 * @return ResourceFactory
78 */
79 protected function getFileFactory() {
80 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
81 }
82
83 }
84
85
86 ?>