[TYPO3-dev] Extbase: Setting relational field to empty using frontend´

Anders Gissel invadercyg at gmail.com
Mon Feb 18 21:09:10 CET 2013


Hello Henjo,

the problem here is that the setter never gets called - if it did, it 
would empty the field just fine (like the hack'y example by Stefano 
does). I'll have a look at the validators, but honestly I can't see how 
a validator would help here. The whole point is that the field should 
allow empty values (and does, if edited through the backend), but that 
the model setter /isn't/ actually called. And if the setter isn't 
called, I can't keep my model logic inside the domain AND fix the 
problem. Not this way, at least. :-)


Best regards,
Anders



On 16-02-2013 11:21, Henjo Hoeksma | Stylence wrote:
> Like I said in my response to Stefano, it would be better to check in your
> setter method of your model to check wether something is NULL or not.
> If it is some fancy checking you need to do, you could write a Domain
> Utility of Custom Domain Object Validator to do so.
>
> Take a look at the validator classes to see what it possible there.
>
> When putting this stuff in your controller you are placing domain logic in
> your application, instead of keeping it in the domain.
> Doing this you will find yourself repeating code to achieve the same things
> over and over and you are on a fast track of getting into trouble ;-)
>
> Kind regards,
>
> Henjo
>
> Problems are small because we learned how to deal with them.
> Problems are big because we need to learn how to deal with them.
>
>
> On Fri, Feb 15, 2013 at 7:19 PM, Stefano Cecere <scecere at krur.com> wrote:
>
>> Hi Anders
>>
>> i have the same problem
>> i explained it (with a solution i found) here
>> http://forum.typo3.org/index.**php/t/194225/<http://forum.typo3.org/index.php/t/194225/>
>>
>> note : the typo3v4mvc newsgroup is the right place for Extbase/Fluid topics
>>
>> ciao
>>
>>
>>
>> On 14/02/13 14:07, Anders Gissel wrote:
>>
>>> Hey y'all,
>>>
>>> I'm building an Extbase-extension (6.0.1), and my model has a field that
>>> relates to another table using a simple dropdown. The user can then
>>> select a single value, and all is fine.
>>>
>>> However: once the user has selected (and saved) a value, he can't empty
>>> the field again... I've added an empty value to both the frontend
>>> selector and the TCA, but apparently setting an empty value is the same
>>> as selecting nothing at all. Therefore, the only way to empty the field
>>> is to do it through the backend. Selecting a different value works just
>>> fine, but obviously that's not what I'm after.
>>>
>>> My question then is: how do I empty the field from the frontend? Once
>>> the data reaches the controller's updateAction() it has already been
>>> processed, so how do I go about it? Can anyone recommend any material on
>>> the subject?
>>>
>>>
>>> Best regards,
>>> Anders
>>>
>>
>> --
>>
>> -- --- ----- -------
>>
>> Stefano Cecere
>> KRUR studio - http://krur.com
>>
>> ______________________________**_________________
>> TYPO3-dev mailing list
>> TYPO3-dev at lists.typo3.org
>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>
>>
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev




More information about the TYPO3-dev mailing list