Skip to content

Instantly share code, notes, and snippets.

@helhum
Last active August 29, 2015 13:59
Show Gist options
  • Save helhum/10580317 to your computer and use it in GitHub Desktop.
Save helhum/10580317 to your computer and use it in GitHub Desktop.
Extbase Reflection
<?php
namespace Helhum\Example\Controller;
/***************************************************************
* Copyright notice
*
* (c) 2014 Helmut Hummel
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use \TYPO3\CMS\Extbase\Domain\Model\File;
/**
*
*
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*
*/
class ImageController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
public function listAction() {
$images = \TYPO3\CMS\Core\Resource\Collection\FolderBasedFileCollection::create(
array(
'storage' => 1,
'folder' => '/content/images/'
),
TRUE
);
$this->view->assign('images', $images);
}
/**
* Works
*
* @param \TYPO3\CMS\Extbase\Domain\Model\File $image
*/
public function show1Action(\TYPO3\CMS\Extbase\Domain\Model\File $image) {
$this->view->assign('image', $image);
}
/**
* Works
*
* @param \TYPO3\CMS\Extbase\Domain\Model\File $image
*/
public function show2Action($image) {
$this->view->assign('image', $image);
}
/**
* Works
*
* @param File $image
*/
public function show3Action(File $image) {
$this->view->assign('image', $image);
}
/**
* Fails
*
* @param File $image
*/
public function show4Action($image) {
$this->view->assign('image', $image);
}
/**
* Works
*
* @param IDoNotExtist $image
*/
public function show5Action(\TYPO3\CMS\Extbase\Domain\Model\File $image) {
$this->view->assign('image', $image);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment