[FLOW3-general] Submit not saved object in forms
ad
a.dudek at adgrafik.at
Thu Feb 25 14:41:36 CET 2010
Hi!
I have a form to add an contact. In this form you can attach addresses.
Now I want do this allready at adding the contact. For this I set a link
like this:
<f:link.action action="newAddress" controller="Address"
arguments="{contact: newContact}">Adresse hinzufügen</f:link.action>
output:
<a
href="[...]/addressbook/address/newaddress?contact%5B__identity%5D=d99fe2dd-d17a-40bd-abd1-5b5244fc0edc">Adresse
hinzufügen</a>
newContact is the object created by the controller function:
/**
* Creates a new contact
*
* @param \F3\AddressBook\Domain\Model\Contact $newContact
* @return string
* @dontvalidate $newContact
*/
public function
newContactAction(\F3\AddressBook\Domain\Model\Contact $newContact = NULL) {
if ($newContact === NULL) {
$newContact =
$this->objectFactory->create('F3\AddressBook\Domain\Model\Contact');
}
$this->view->assign('newContact', $newContact);
}
The controller for newAddress is:
/**
* Creates a new address
*
* @param \F3\AddressBook\Domain\Model\Contact $contact
* @param \F3\AddressBook\Domain\Model\Address $newAddress
* @return string
* @dontvalidate $newAddress
*/
public function
newAddressAction(\F3\AddressBook\Domain\Model\Contact $contact,
\F3\AddressBook\Domain\Model\Address $newAddress = NULL) {
if ($newAddress === NULL) {
$newAddress =
$this->objectFactory->create('F3\AddressBook\Domain\Model\Address');
}
$this->view->assign('contact', $contact);
$this->view->assign('newAddress', $newAddress);
}
But when I want to add a new address an exception is thrown:
#1251730701: The value must be of type
"F3\AddressBook\Domain\Model\Contact", but was of type "NULL".
I think the object is not found. Note: The contact-obect is not saved,
just assign by the form. But isn't the object cached at this time?
lg ad
More information about the FLOW3-general
mailing list