Bug #6087

#1251730702: The value must be of type "Tx_Sffluid_Domain_Model_Customer", but was of type "array".

Added by Stefan Froemken over 5 years ago. Updated almost 5 years ago.

Status:Closed Start date:2010-01-18
Priority:Won't have this time Due date:
Assigned To:- % Done:

100%

Category:Core
Target version:-
Has patch: Affected Flow version:

Description

Hello...I just try to learn Fluid, but when I want to save some values following error appears:

#1251730702: The value must be of type "Tx_Sffluid_Domain_Model_Customer", but was of type "array".

edit.html:
<p class="bodytext">Editieren Sie den Kunden:</p>
<f:form method="post" action="update" name="customer" object="{customer}">
<label for="firstname">Vorname</label><br />
<f:form.textbox property="firstname" /><br />
<label for="lastname">Nachname</label><br />
<f:form.textbox property="lastname" /><br />
<f:form.submit class="submit" value="Submit"/>
</f:form>

CustomerController.php:
class Tx_Sffluid_Controller_CustomerController extends Tx_Extbase_MVC_Controller_ActionController {
protected $customerRepository;

public function initializeAction() {
$this->customerRepository= t3lib_div::makeInstance('Tx_Sffluid_Domain_Repository_CustomerRepository');
}
public function indexAction() {
$this->view->assign('zahl', 12);
$this->view->assign('customers', $this->customerRepository->findAll());
}
public function editAction(Tx_Sffluid_Domain_Model_Customer $customer) {
$this->view->assign('customer', $customer);
}
public function updateAction(Tx_Sffluid_Domain_Model_Customer $customer) {
$this->customerRepository->update($customer);
$this->flashMessages->add('Der Kunde wurde aktualisiert.');
$this->redirect('index');
}
}

I can't find an error. The code is nearly the same as in blog_example. What's wrong here?!

Stefan Frömken

Fluid: 1.0.2
TYPO3: 4.3.1

History

#1 Updated by Stefan Froemken over 5 years ago

  • % Done changed from 0 to 100

I found it: Without comments FLOW3 don't converts the array to an object.
For every variable in model-file you have to add an comment like this:

/** * The customer's first name. * * @var string
*/

#2 Updated by Sebastian Kurfuerst about 5 years ago

  • Status changed from New to Closed
  • Priority changed from Should have to Won't have this time

Also available in: Atom PDF