[TYPO3-mvc] Problem with Property mapping

Eike Starkmann starkmann at undkonsorten.com
Thu Jun 12 12:51:04 CEST 2014


Hi,

i have a strange behaviour in the property mapping.

Situation:

Model:
class A{
	protected aThing;
}

class B extends A{
	protected bThing;
}


Now i have an edit mask in FE. I want to use just one editAction for
both types:

public editAction(\Something\A $a){
.....
}

public updateAction(\Something\A $a){....}

In fuild I have template like this:

....

<f:if condtion="a.type=tx_..._a">
	<f:form.textfield property="a" />
</if>
<f:if condtion="a.type=tx_..._b">
	<f:form.textfield property="b" />
</if>

But when i edit type b and press edit "Save" button i get this error:

Exception while property mapping at property path "":Property "b" was
not found in target object of type "...\Wall\Domain\Model\A"

I try to avoid that by using an Interface:

interface AInterface{}

class A implements AInterface{
	protected aThing;
}

class B extends A {
	protected bThing;
}


public editAction(\Something\AInterface $a){
.....
}

public updateAction(\Something\AInterface $a){....}

But then i get the error that the class AInterface can not be found.


A workaround would be to have different actions for each type but since
i have more than just one subclass i don't want to do that.

Any ideas?

regards, Eike Starkmann


More information about the TYPO3-project-typo3v4mvc mailing list