[FLOW3-general] Mapping data on existing objects
Regine Rosewich
regine.rosewich at hoellenberg.biz
Thu Jul 7 15:38:14 CEST 2011
Hi Pascal,
I suppose, it would be helpful for you to have the persistence_identifier of
the objects transferred to ExtJs via ExtDirect (even if you keep them hidden
on the ExtJS-Side). This can be achieved by using the
"_exposeObjectIdentifier" Property in the ExtDirect\View as show in the
example below.
class StandardView extends \F3\ExtJS\ExtDirect\View {
/**
* @param array $data the data to be listed
* @return void
* @author Regine Rosewich - aurum GmbH, Freiamt
*/
public function completeList($data) {
$this->setConfiguration(
array(
'value' => array(
'data' => array (
'_descendAll' => array(
'_exposeObjectIdentifier' => TRUE
)
)
)
)
);
$this->assign('value', array('data' => $data, 'success' =>
TRUE,));
}
}
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.
Ext.define('F3.WeluPdm.Module.Stammdaten.Data.AuspraegungModel', {
extend: 'Ext.data.Model',
alias: 'widget.F3.WeluPdm.Module.Stammdaten.Data.AuspraegungModel',
idProperty: '__identity',
fields: ['auspraegung',
'bezeichnung',
]
});
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: Donnerstag, 7. Juli 2011 00:13
> An: General discussion about FLOW3
> Betreff: [FLOW3-general] Mapping data on existing objects
>
> Hi FLOW3 ninjas,
>
> I'm currently trying to update objects with ExtDirect and the
> Ext.data.Grid. The problem is that the type of the objects is only
> known at runtime so I cannot annotate the class name/type in the
> ExtDirect controller to build the correct object out of the data it
> receives (like it would if you submit something with Fluid).
> So my initial plan was it to get the "old" object from the database
> using the identifier, call mapAndValidate() with the new data and then
> update() it. Unfortunately the new PropertyMapper only has a function
> convert() which doesn't accept objects any more.
> How can I map that data from ExtDirect onto the old object? I'd be glad
> if you have some hints for me.
>
> 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