[TYPO3-mvc] object Storage
Christian Schwan - Dimme GmbH
christian.schwan at dimme.ch
Thu Jul 29 09:44:57 CEST 2010
He guys,
can anybody tell me how i update/delete an object storage? I wanne
update/delete the items (Object Storage) over the the OfferController.
My model:
----------------------------------------
/**
* @var Tx_Extbase_Persistence_ObjectStorage<Tx_Crm_Domain_Model_Items>
*/
protected $items;
/**
* Setter for Items
*
* @param Tx_Extbase_Persistence_ObjectStorage $items One or
more Tx_Crm_Domain_Model_Items objects
* @return void
*/
public function
setItems(Tx_Extbase_Persistence_ObjectStorage $items) {
$this->items = clone $items;
}
/**
* Adds a Item to this Offer
*
* @param Tx_Crm_Domain_Model_Items $items
* @return void
*/
public function addItems(Tx_Crm_Domain_Model_Items $items) {
$this->items->attach($items);
My Fluid EDIT/UPDATE Template:
----------------------------------------------
I tried to do items.{value}.qty, without sending a hidden uid, but somehow
the object Storage does not send the UID the the Controller!
<f:for each="{offer.items}" as="items" key="value">
<f:form.textbox property="items. {value}.qty" value="{items.qty}" size="9"
additionalAttributes="{onkeyup : 'cal();'}" class="qtye" id="item_qty_0" />
<f:form.textarea property="items{value}.description"
value="{items.description}" rows="1" cols="67" class="description"
id="item_description_0" <f:form.textbox property="items. {value}. price"
value="{items.price}" size="9" additionalAttributes="{onkeyup : 'cal();'}"
class="price" id="item_price_0">
<f:form.hidden property="items.{value}.uid" value="{items.uid}" /><input
type="button" class="delRow" value="Delete Row"/>
</f:for>
With the hidden UID form and the Setter (setUid) in Domain_Model_Items it
works.
<f:for each="{offer.items}" as="items" key="value">
<f:form.textbox property="items.{items.uid}.qty" value="{items.qty}"
size="9" additionalAttributes="{onkeyup : 'cal();'}" class="qtye"
id="item_qty_0" />
<f:form.textarea property="items.{items.uid}.description"
value="{items.description}" rows="1" cols="67" class="description"
id="item_description_0" <f:form.textbox property="items.{items.uid}.price"
value="{items.price}" size="9" additionalAttributes="{onkeyup : 'cal();'}"
class="price" id="item_price_0">
<f:form.hidden property="items.{items.uid}.uid" value="{items.uid}" /><input
type="button" class="delRow" value="Delete Row"/>
</f:for>
Does anyone can help me out?
Christian
More information about the TYPO3-project-typo3v4mvc
mailing list