Commit 81416246 authored by Sebastian Kurfürst's avatar Sebastian Kurfürst
Browse files

[TASK] Extbase (Persistence): Removed PreparedQuery for now, as it is not used at all.

[TASK] Extbase (Persistence): Removed work-in-progress TCEMAIN hook as it was not working reliably anyways.
[TASK] Extbase: Added all @api tags and cleaned up doc comments. Resolves #3917.
parent 75987f07
......@@ -26,8 +26,9 @@
* Creates a request an dispatches it to the controller which was specified
* by TS Setup, Flexform and returns the content to the v4 framework.
*
* This class is the main entry point for extbase extensions in the frontend.
*
* @package Extbase
* @subpackage extbase
* @version $ID:$
*/
class Tx_Extbase_Dispatcher {
......
......@@ -5,7 +5,7 @@
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* All rights reserved
*
* This class is a backport of the corresponding class of FLOW3.
* This class is a backport of the corresponding class of FLOW3.
* All credits go to the v5 team.
*
* This script is part of the TYPO3 project. The TYPO3 project is
......@@ -26,10 +26,9 @@
***************************************************************/
/**
* A generic MVC exception
* A generic Extbase exception
*
* @package Extbase
* @subpackage extbase
* @version $ID: $
*/
class Tx_Extbase_Exception extends Exception {
......
......@@ -29,13 +29,13 @@
* An abstract base class for Controllers
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $ID:$
*/
abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbase_MVC_Controller_ControllerInterface {
/**
* @var Tx_Extbase_Object_ManageInterface
* @var Tx_Extbase_Object_ManagerInterface
*/
protected $objectManager;
......@@ -53,16 +53,23 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* Contains the settings of the current extension
*
* @var array
* @api
*/
protected $settings;
/**
* @var Tx_Extbase_MVC_Request The current request
* The current request.
*
* @var Tx_Extbase_MVC_Request
* @api
*/
protected $request;
/**
* @var Tx_Extbase_MVC_Response The response which will be returned by this action controller
* The response which will be returned by this action controller
*
* @var Tx_Extbase_MVC_Response
* @api
*/
protected $response;
......@@ -84,6 +91,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
/**
* The results of the mapping of request arguments to controller arguments
* @var Tx_Extbase_Property_MappingResults
* @api
*/
protected $argumentsMappingResults;
......@@ -111,7 +119,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
*
* @param Tx_Extbase_Property_Mapper $propertyMapper The property mapper
* @return void
*/
public function injectPropertyMapper(Tx_Extbase_Property_Mapper $propertyMapper) {
$this->propertyMapper = $propertyMapper;
......@@ -122,7 +129,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
*
* @param array $settings Settings container of the current extension
* @return void
*/
public function injectSettings(array $settings) {
$this->settings = $settings;
......@@ -133,7 +139,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
*
* @param Tx_Extbase_Object_ManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(Tx_Extbase_Object_ManagerInterface $objectManager) {
$this->objectManager = $objectManager;
......@@ -144,7 +149,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
*
* @param Tx_Extbase_Validation_ValidatorResolver $validatorResolver
* @return void
*/
public function injectValidatorResolver(Tx_Extbase_Validation_ValidatorResolver $validatorResolver) {
$this->validatorResolver = $validatorResolver;
......@@ -159,6 +163,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
*
* @param Tx_Extbase_MVC_Request $request The current request
* @return boolean TRUE if this request type is supported, otherwise FALSE
* @api
*/
public function canProcessRequest(Tx_Extbase_MVC_Request $request) {
foreach ($this->supportedRequestTypes as $supportedRequestType) {
......@@ -174,6 +179,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* @param Tx_Extbase_MVC_Response $response The response, modified by this handler
* @return void
* @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType if the controller doesn't support the current request type
* @api
*/
public function processRequest(Tx_Extbase_MVC_Request $request, Tx_Extbase_MVC_Response $response) {
if (!$this->canProcessRequest($request)) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes) , 1187701131);
......@@ -193,7 +199,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* Initialize the controller context
*
* @return Tx_Extbase_MVC_Controller_ControllerContext ControllerContext to be passed to the view
* @api
*/
protected function buildControllerContext() {
$controllerContext = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ControllerContext');
......@@ -218,6 +224,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* @param Tx_Extbase_MVC_Controller_Arguments $arguments Arguments to pass to the target action
* @return void
* @throws Tx_Extbase_MVC_Exception_StopAction
* @api
*/
public function forward($actionName, $controllerName = NULL, $extensionName = NULL, array $arguments = NULL) {
$this->request->setDispatched(FALSE);
......@@ -244,6 +251,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* @return void
* @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType If the request is not a web request
* @throws Tx_Extbase_MVC_Exception_StopAction
* @api
*/
protected function redirect($actionName, $controllerName = NULL, $extensionName = NULL, array $arguments = NULL, $pageUid = NULL, $delay = 0, $statusCode = 303) {
if (!$this->request instanceof Tx_Extbase_MVC_Web_Request) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType('redirect() only supports web requests.', 1220539734);
......@@ -269,6 +277,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
* @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType If the request is not a web request
* @throws Tx_Extbase_MVC_Exception_StopAction
* @api
*/
protected function redirectToURI($uri, $delay = 0, $statusCode = 303) {
if (!$this->request instanceof Tx_Extbase_MVC_Web_Request) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType('redirect() only supports web requests.', 1220539734);
......@@ -291,6 +300,7 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* @param string $content Body content which further explains the status
* @throws Tx_Extbase_MVC_Exception_UnsupportedRequestType If the request is not a web request
* @throws Tx_Extbase_MVC_Exception_StopAction
* @api
*/
public function throwStatus($statusCode, $statusMessage = NULL, $content = NULL) {
if (!$this->request instanceof Tx_Extbase_MVC_Web_Request) throw new Tx_Extbase_MVC_Exception_UnsupportedRequestType('throwStatus() only supports web requests.', 1220539739);
......@@ -306,7 +316,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* controller argument and adds them to the argument's validator chain.
*
* @return void
*/
public function initializeControllerArgumentsBaseValidators() {
foreach ($this->arguments as $argument) {
......@@ -319,7 +328,6 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
* Maps arguments delivered by the request object to the local controller arguments.
*
* @return void
*/
protected function mapRequestArgumentsToControllerArguments() {
$optionalPropertyNames = array();
......@@ -333,4 +341,4 @@ abstract class Tx_Extbase_MVC_Controller_AbstractController implements Tx_Extbas
$this->argumentsMappingResults = $this->propertyMapper->getMappingResults();
}
}
?>
?>
\ No newline at end of file
......@@ -36,7 +36,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
/**
* @var Tx_Extbase_Reflection_Service
*/
protected $reflectionService;
......@@ -46,6 +45,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* If none is available the $defaultViewObjectName will be used and finally
* an EmptyView will be created.
* @var Tx_Extbase_MVC_View_ViewInterface
* @api
*/
protected $view = NULL;
......@@ -53,6 +53,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* Pattern after which the view object name is built if no Fluid template
* is found.
* @var string
* @api
*/
protected $viewObjectNamePattern = 'Tx_@extension_View_@controller_@action';
......@@ -60,18 +61,21 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* The default view object to use if neither a Fluid template nor an action
* specific view object could be found.
* @var string
* @api
*/
protected $defaultViewObjectName = NULL;
/**
* Name of the action method
* @var string
* @api
*/
protected $actionMethodName = 'indexAction';
/**
* Name of the special error action method which is called in case of errors
* @var string
* @api
*/
protected $errorMethodName = 'errorAction';
......@@ -80,7 +84,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
*
* @param Tx_Extbase_Reflection_Service $reflectionService
* @return void
*/
public function injectReflectionService(Tx_Extbase_Reflection_Service $reflectionService) {
$this->reflectionService = $reflectionService;
......@@ -144,7 +147,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
*
* @return void
* @see initializeArguments()
*/
protected function initializeActionMethodArguments() {
$methodParameters = $this->reflectionService->getMethodParameters(get_class($this), $this->actionMethodName);
......@@ -166,7 +168,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* specified in the @validate annotations of an action method
*
* @return void
*/
protected function initializeActionMethodValidators() {
$validatorConjunctions = $this->validatorResolver->buildMethodArgumentsValidatorConjunctions(get_class($this), $this->actionMethodName);
......@@ -181,7 +182,6 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
*
* @return string The action method name
* @throws Tx_Extbase_MVC_Exception_NoSuchAction if the action specified in the request object does not exist (and if there's no default action either).
*/
protected function resolveActionMethodName() {
$actionMethodName = $this->request->getControllerActionName() . 'Action';
......@@ -198,7 +198,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
*
* @param string $actionMethodName Name of the action method to call
* @return void
* @api
*/
protected function callActionMethod() {
$argumentsAreValid = TRUE;
......@@ -225,6 +225,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* the current action.
*
* @return void
* @api
*/
protected function resolveView() {
$view = $this->objectManager->getObject('Tx_Fluid_View_TemplateView');
......@@ -248,6 +249,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* Determines the fully qualified view object name.
*
* @return mixed The fully qualified view object name or FALSE if no matching view could be found.
* @api
*/
protected function resolveViewObjectName() {
$possibleViewName = $this->viewObjectNamePattern;
......@@ -273,6 +275,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
*
* @param Tx_Extbase_View_ViewInterface $view The view to be initialized
* @return void
* @api
*/
protected function initializeView(Tx_Extbase_MVC_View_ViewInterface $view) {
}
......@@ -284,6 +287,7 @@ class Tx_Extbase_MVC_Controller_ActionController extends Tx_Extbase_MVC_Controll
* common.
*
* @return void
* @api
*/
protected function initializeAction() {
}
......
......@@ -5,7 +5,7 @@
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* All rights reserved
*
* This class is a backport of the corresponding class of FLOW3.
* This class is a backport of the corresponding class of FLOW3.
* All credits go to the v5 team.
*
* This script is part of the TYPO3 project. The TYPO3 project is
......@@ -29,7 +29,7 @@
* A controller argument
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $ID:$
* @scope prototype
*/
......@@ -44,7 +44,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* @var Tx_Extbase_Persistence_QueryFactory
*/
protected $queryFactory;
/**
* @var Tx_Extbase_Property_Mapper
*/
......@@ -104,6 +104,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* @param string $name Name of this argument
* @param string $dataType The data type of this argument
* @throws InvalidArgumentException if $name is not a string or empty
* @api
*/
public function __construct($name, $dataType = 'Text') {
$this->propertyMapper = t3lib_div::makeInstance('Tx_Extbase_Property_Mapper');
......@@ -121,7 +122,6 @@ class Tx_Extbase_MVC_Controller_Argument {
*
* @param Tx_Extbase_Persistence_ManagerInterface
* @return void
*/
public function injectPersistenceManager(Tx_Extbase_Persistence_ManagerInterface $persistenceManager) {
$this->persistenceManager = $persistenceManager;
......@@ -132,16 +132,16 @@ class Tx_Extbase_MVC_Controller_Argument {
*
* @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
* @return void
*/
public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
$this->queryFactory = $queryFactory;
}
/**
* Returns the name of this argument
*
* @return string This argument's name
* @api
*/
public function getName() {
return $this->name;
......@@ -153,6 +153,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* @param string $shortName A "short name" - a single character
* @return Tx_Extbase_MVC_Controller_Argument $this
* @throws InvalidArgumentException if $shortName is not a character
* @api
*/
public function setShortName($shortName) {
if ($shortName !== NULL && (!is_string($shortName) || strlen($shortName) !== 1)) throw new InvalidArgumentException('$shortName must be a single character or NULL', 1195824959);
......@@ -164,16 +165,18 @@ class Tx_Extbase_MVC_Controller_Argument {
* Returns the short name of this argument
*
* @return string This argument's short name
* @api
*/
public function getShortName() {
return $this->shortName;
}
/**
* Sets the data type of this argument's value
*
* @param string $dataType The data type. Can be either a built-in type such as "Text" or "Integer" or a fully qualified object name
* @return Tx_Extbase_MVC_Controller_Argument $this
* @api
*/
public function setDataType($dataType) {
$this->dataType = $dataType;
......@@ -184,6 +187,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* Returns the data type of this argument's value
*
* @return string The data type
* @api
*/
public function getDataType() {
return $this->dataType;
......@@ -194,6 +198,7 @@ class Tx_Extbase_MVC_Controller_Argument {
*
* @param boolean $required TRUE if this argument should be required
* @return Tx_Extbase_MVC_Controller_Argument $this
* @api
*/
public function setRequired($required) {
$this->isRequired = (boolean)$required;
......@@ -204,6 +209,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* Returns TRUE if this argument is required
*
* @return boolean TRUE if this argument is required
* @api
*/
public function isRequired() {
return $this->isRequired;
......@@ -214,6 +220,7 @@ class Tx_Extbase_MVC_Controller_Argument {
*
* @param mixed $defaultValue Default value
* @return void
* @api
*/
public function setDefaultValue($defaultValue) {
$this->defaultValue = $defaultValue;
......@@ -223,16 +230,18 @@ class Tx_Extbase_MVC_Controller_Argument {
* Returns the default value of this argument
*
* @return mixed The default value
* @api
*/
public function getDefaultValue() {
return $this->defaultValue;
}
/**
* Sets a custom validator which is used supplementary to the base validation
*
* @param Tx_Extbase_Validation_Validator_ValidatorInterface $validator The actual validator object
* @return Tx_Extbase_MVC_Controller_Argument Returns $this (used for fluent interface)
* @api
*/
public function setValidator(Tx_Extbase_Validation_Validator_ValidatorInterface $validator) {
$this->validator = $validator;
......@@ -244,6 +253,7 @@ class Tx_Extbase_MVC_Controller_Argument {
*
* @param array Object names of the validators
* @return Tx_Extbase_MVC_Controller_Argument Returns $this (used for fluent interface)
* @api
*/
public function setNewValidatorConjunction(array $objectNames) {
if ($this->validator === NULL) {
......@@ -255,10 +265,12 @@ class Tx_Extbase_MVC_Controller_Argument {
}
return $this;
}
/**
* Returns the set validator
*
* @return Tx_Extbase_Validation_Validator_ValidatorInterface The set validator, NULL if none was set
* @api
*/
public function getValidator() {
return $this->validator;
......@@ -295,7 +307,7 @@ class Tx_Extbase_MVC_Controller_Argument {
$this->value = $value;
return $this;
}
/**
* Finds an object from the repository by searching for its technical UID.
*
......@@ -308,16 +320,17 @@ class Tx_Extbase_MVC_Controller_Argument {
$object = NULL;
if (count($result) > 0) {
$object = current($result);
// TODO Check if the object is an Aggregate Root (this can be quite difficult because we have no Repository registration
// TODO Check if the object is an Aggregate Root (this can be quite difficult because we have no Repository registration
$this->persistenceManager->getSession()->registerReconstitutedObject($object);
}
return $object;
return $object;
}
/**
* Returns the value of this argument
*
* @return object The value of this argument - if none was set, NULL is returned
* @api
*/
public function getValue() {
if ($this->value === NULL) {
......@@ -340,6 +353,7 @@ class Tx_Extbase_MVC_Controller_Argument {
* Returns a string representation of this argument's value
*
* @return string
* @api
*/
public function __toString() {
return (string)$this->value;
......
......@@ -25,17 +25,12 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* @package Extbase
* @subpackage MVC
* @version $Id: PropertyError.php 2523 2009-06-02 10:35:40Z k-fish $
*/
/**
* This object holds validation errors for one argument.
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $Id: PropertyError.php 2523 2009-06-02 10:35:40Z k-fish $
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
* @scope prototype
......
......@@ -5,7 +5,7 @@
* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* All rights reserved
*
* This class is a backport of the corresponding class of FLOW3.
* This class is a backport of the corresponding class of FLOW3.
* All credits go to the v5 team.
*
* This script is part of the TYPO3 project. The TYPO3 project is
......@@ -29,7 +29,7 @@
* A composite of controller arguments
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $ID:$
* @scope prototype
*/
......@@ -44,7 +44,7 @@ class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
* @var Tx_Extbase_Persistence_QueryFactory
*/
protected $queryFactory;
/**
* @var array Names of the arguments contained by this object
*/
......@@ -65,12 +65,11 @@ class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
*
* @param Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory
* @return void
*/
public function injectQueryFactory(Tx_Extbase_Persistence_QueryFactoryInterface $queryFactory) {
$this->queryFactory = $queryFactory;
}
/**
* Adds or replaces the argument specified by $value. The argument's name is taken from the
* argument object itself, therefore the $offset does not have any meaning in this context.
......@@ -266,7 +265,6 @@ class Tx_Extbase_MVC_Controller_Arguments extends ArrayObject {
* Remove all arguments and resets this object
*
* @return void
*/
public function removeAll() {
foreach ($this->argumentNames as $argumentName => $booleanValue) {
......
......@@ -29,7 +29,7 @@
* A validator for controller arguments
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $ID:$
* @scope prototype
*/
......@@ -87,7 +87,7 @@ class Tx_Extbase_MVC_Controller_ArgumentsValidator extends Tx_Extbase_Validation
$argumentValue = $argument->getValue();
if ($argumentValue === $argument->getDefaultValue() && $argument->isRequired() === FALSE) return TRUE;
if ($validatorConjunction->isValid($argumentValue) === FALSE) {
$this->addErrorsForArgument($validatorConjunction->getErrors(), $argumentName);
return FALSE;
......@@ -102,7 +102,6 @@ class Tx_Extbase_MVC_Controller_ArgumentsValidator extends Tx_Extbase_Validation
* @param array $errors Array of \F3\FLOW3\Validation\Error
* @param string $argumentName Name of the argument to add errors for
* @return void
*/
protected function addErrorsForArgument(array $errors, $argumentName) {
if (!isset($this->errors[$argumentName])) {
......@@ -110,6 +109,6 @@ class Tx_Extbase_MVC_Controller_ArgumentsValidator extends Tx_Extbase_Validation
}
$this->errors[$argumentName]->addErrors($errors);
}
}
?>
\ No newline at end of file
......@@ -29,7 +29,7 @@
* The controller context contains information from the controller
*
* @package Extbase
* @subpackage MVC
* @subpackage MVC\Controller
* @version $Id: AbstractController.php 2203 2009-05-12 18:44:47Z networkteam_hlubek $
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
* @scope prototype
......@@ -66,7 +66,6 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
*
* @param Tx_Extbase_MVC_Request $request
* @return void
*/
public function setRequest(Tx_Extbase_MVC_Request $request) {
$this->request = $request;
......@@ -76,6 +75,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
* Get the request of the controller
*
* @return Tx_Extbase_MVC_Request
* @api
*/
public function getRequest() {
return $this->request;
......@@ -86,7 +86,6 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
*
* @param Tx_Extbase_MVC_Response $request
* @return void
*/
public function setResponse(Tx_Extbase_MVC_Response $response) {
$this->response = $response;
......@@ -96,6 +95,7 @@ class Tx_Extbase_MVC_Controller_ControllerContext {
* Get the response of the controller