[TYPO3-dev] "nested" domain object with fluid and extbase

Alexander All alexander_all at yahoo.de
Mon Feb 14 10:29:29 CET 2011


Hello Everybody,

i try to creat an new, "nested" domain object with fluid and extbase. The problem is
that company-object contains another object. My question is: how should the fluid template 
looks like? Is that action in one step possible?

Thanks

Below are the models, template and the action:

Tx_MyExt_Domain_Model_Company extends Tx_Extbase_DomainObject_AbstractEntity {

	/**
	 * @var string
	 */
	protected $name = '';
	
	/**
	 * @var Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_Employee>
	 * @lazy
	 * @cascade remove
	 **/
	protected $employees;
	
	/**
	 * Constructs a new Company
	 */
	public function __construct() {
		$this->employees = new Tx_Extbase_Persistence_ObjectStorage();
	}
	
	/* Setter & Getter for $name */
	..
	
	/**
	 * @param Tx_MyExt_Domain_Model_Employee
	 * @return void
	 */
	public function addEmployee(Tx_MyExt_Domain_Model_Employee $employee) {
		$this->employees->attach($employee);
	}

	/**
	 * @param Tx_MyExt_Domain_Model_Employee
	 * @return void
	 */
	public function removeEmployee(Tx_MyExt_Domain_Model_Employee $employee) {
		$this->employees->detach($employee);
	}
}

Tx_MyExt_Domain_Model_Employee extends Tx_Extbase_DomainObject_AbstractEntity {
	/**
	 * @var string
	 */
	protected $name = '';
	
	/* Setter & Getter for $name */
	..
}

Fluid-Template

<f:form method="post" controller="Foo" action="create" name="newCompany" object="{newCompany}">
	<f:form.textfield property="name" />
	<!-- does not work however -->
	<f:form.textfield property="employees.name" />
	
	<f:form.submit value="Submit"/>
</f:form>

Controller

	/**
	 * Creates a new Company
	 *
	 * @param	Tx_MyExt_Domain_Model_Company		$newCompany
	 * @return	void
	 * @dontverifyrequesthash
	 */
	public function createAction(Tx_MyExt_Domain_Model_Company $newCompany) {
		
	}








More information about the TYPO3-dev mailing list