[TYPO3-mvc] Tx_Extbase_Persistence_Repository->add() does not work
Alexander Dick
alex at dick.at
Tue Sep 14 10:23:06 CEST 2010
Hi List,
I have a problem with the add method of the Extbase Persistence Repository - my data does not get inserted in the database!
simplified code:
OrderItemController.php:
$this->orderItemRepository =
&t3lib_div::makeInstance('Tx_XXX_Domain_Repository_OrderItemRepository');
public function updateAction() {
$data = $this->request->getArguments();
$orderItem = $this->createOrderItem($data);
$this->orderItemRepository->add($orderItem);
}
/**
* @param array
* @return Tx_XXX_Domain_Model_OrderItem
*/
protected function createOrderItem($data) {
$orderItem = new Tx_XXX_Domain_Model_OrderItem();
$orderItem->setName($data['firstName'] . ' '. $data['lastName']);
return $orderItem;
}
There is no error and no special output, and $this->orderItemRepository->add($orderItem) gets definately called.
# Plugin configuration
plugin.tx_XXX {
persistence {
classes {
Tx_XXX_Domain_Model_OrderItem {
newRecordStoragePid = 44
mapping {
tableName = tx_XXX_domain_model_order_item
}
}
}
}
}
I really have no idea what's wrong. Please someone help me.
Hi List,
I have a problem with the add method of the Extbase Persistence Repository - my data does not get inserted in the database!
simplified code:
OrderItemController.php:
$this->orderItemRepository =
&t3lib_div::makeInstance('Tx_XXX_Domain_Repository_OrderItemRepository');
public function updateAction() {
$data = $this->request->getArguments();
$orderItem = $this->createOrderItem($data);
$this->orderItemRepository->add($orderItem);
}
/**
* @param array
* @return Tx_XXX_Domain_Model_OrderItem
*/
protected function createOrderItem($data) {
$orderItem = new Tx_XXX_Domain_Model_OrderItem();
$orderItem->setName($data['firstName'] . ' '. $data['lastName']);
return $orderItem;
}
OrderItem.php (the model, simplified)
class Tx_XXX_Domain_Model_OrderItem extends Tx_Extbase_DomainObject_AbstractEntity {
/**
* @var string
*/
protected $name;
/**
* @return string
*/
public function getName() {
return $this->name;
}
/**
* @param string
*/
public function setName($val) {
$this->name = $val;
}
}
There is no error and no special output, and $this->orderItemRepository->add($orderItem) gets definately called.
# Plugin configuration
plugin.tx_XXX {
persistence {
classes {
Tx_XXX_Domain_Model_OrderItem {
newRecordStoragePid = 44
mapping {
tableName = tx_XXX_domain_model_order_item
}
}
}
}
}
I really have no idea what's wrong. Please someone help me.
cheers
Alex
More information about the TYPO3-project-typo3v4mvc
mailing list