3 namespace wcf\data\template
;
5 use wcf\data\DatabaseObjectList
;
6 use wcf\data\package\PackageCache
;
7 use wcf\system\application\ApplicationHandler
;
10 * Represents a list of templates.
12 * @author Alexander Ebert
13 * @copyright 2001-2019 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\Data\Template
17 * @method Template current()
18 * @method Template[] getObjects()
19 * @method Template|null search($objectID)
20 * @property Template[] $objects
22 class TemplateList
extends DatabaseObjectList
27 public $className = Template
::class;
30 * Creates a new TemplateList object.
32 public function __construct()
34 parent
::__construct();
36 $this->sqlSelects
= 'package.package, template_group.templateGroupFolderName';
38 LEFT JOIN wcf" . WCF_N
. "_package package
39 ON package.packageID = template.packageID
40 LEFT JOIN wcf" . WCF_N
. "_template_group template_group
41 ON template_group.templateGroupID = template.templateGroupID";
47 public function readObjects()
49 parent
::readObjects();
51 foreach ($this->objects
as $template) {
52 if ($template->application
!= 'wcf') {
53 $application = ApplicationHandler
::getInstance()->getApplication($template->application
);
55 $application = ApplicationHandler
::getInstance()->getWCF();
57 $package = PackageCache
::getInstance()->getPackage($application->packageID
);
59 // set directory of the application package the template
61 $template->packageDir
= $package->packageDir
;