[TYPO3-mvc] Fluid: Complex forms best practice

Nikolas Hagelstein lists at shr-now.de
Mon Jul 13 14:30:31 CEST 2009


Hi Sebastian,

>i agree that the solution of putting together in the consturct is a 
>great idea

>class implements ArrayAccess { 
>[...]
>Maybe something like this would do the job

Even better:

<?php
class Tx_MyExt_Controllerhelper_ContainerControllerhelper extends
ArrayObject {

	public function __construct($array = array(), $flags = 0,
$iterator_class = 'ArrayIterator') {
		parent::__construct($array, $flags = 0, $iterator_class =
'ArrayIterator');
	}

	public function __call($methodName, array $arguments) {
		$argumentName = strtolower($methodName{3} .
substr($methodName, 4));

		if (substr($methodName, 0, 3) == 'get')
			return $this->__get($argumentName);

		if (substr($methodName, 0, 3) == 'set')
			$this->__set($argumentName, $arguments[0]);

	}

	public function __set($name, $value) {
		$this->offsetSet($name, $value);
	}

	public function __get($name) {
		return $this->offsetGet($name);
	}


}
?>

Cheers,
Nikolas



More information about the TYPO3-project-typo3v4mvc mailing list