[FLOW3-general] Mapping data on existing objects

Regine Rosewich regine.rosewich at hoellenberg.biz
Fri Jul 8 13:00:22 CEST 2011


Hi Pascal (Jascal?),

the bad news is, that 
1. you have to handle both Actions (Read the Data, Update the Data) with
separate ExtDirect Actions(Controller-Methods / have a look at the "Service"
branch of the "Classes" folder in the TYPO3V5 Package)
2. If the ExtJS - update Request always contains all properties of the
object to be updated (including the persistence_identifier), the following
controller-method-example works perfectly.

/**
* @param \F3\<Package>\Domain\Model\<Object> $<object>
* @return void
* @extdirect
*/
	public function
update<Object>Action(\F3\<Object>\Domain\Model\<Object> $<object>) {
		$account =
$this->securityContext->getAccount()->getAccountIdentifier(); //only for
security reasons
		if ($<object> !== Null) {
			if ($account !== NULL) {
				// updates the Update-Information in the
abstract Data-Object
				$<object>->setUpdateDate(new \DateTime());
	
$<object>->setUpdateParty($this->securityContext->getParty());
				// persist the update
	
$this-><object>Repository->update($<object>);
				$this->view->assign('value', array('success'
=> TRUE));
			}
		}
	}

Hope it helps.

Regine


> -----Ursprüngliche Nachricht-----
> Von: flow3-general-bounces at lists.typo3.org [mailto:flow3-general-
> bounces at lists.typo3.org] Im Auftrag von Pascal Jungblut
> Gesendet: Freitag, 8. Juli 2011 10:35
> An: General discussion about FLOW3
> Betreff: Re: [FLOW3-general] Mapping data on existing objects
> 
> Hi Regine,
> 
> On 07.07.2011, at 15:38, Regine Rosewich wrote:
> 
> > If you furthermore work with Ext.data.Model classes on the ExtJs Side
> you
> > can there use the property 'idProperty' and ExtJs will always
> incorporate
> > the persistence_identifier into the JSON Requests.
> 
> I have that working - thanks to your help on the IRC! The problem is to
> store the information again: normally you would use a Fluid form and
> submit it. F3 would then create an object which is passed to the
> updateAction(). The problem here is that I can not annotate the
> updateAction with "@var F3\Foo\Domain\Model\Object" because I only know
> the object's type on runtime.
> 
> So how do I update an arbitrary object?
> 
> Regards
> Pascal
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general




More information about the FLOW3-general mailing list