christian ewigfrost
2018-01-29 08:44:26 UTC
One of my TYPO3 extension classes uses a property (checklist) that is an object storage.
class Kaufmnnisch extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
public function __construct(){
$this->checklist = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* checklist
*
* @var Tx_Extbase_Persistence_ObjectStorage
* @lazy
*/
protected $checklist;
/**
* Returns the checklist
*
* @return Tx_Extbase_Persistence_ObjectStorage $checklist
*/
public function getChecklist()
{
return $this->checklist;
}
/**
* Sets the checklist
*
* @param Tx_Extbase_Persistence_ObjectStorage $checklist
* @return void
*/
public function setChecklist($checklist)
{
$this->checklist = $checklist;
}
/**
* Returns the boolean state of checklist
*
* @return bool
*/
public function isChecklist()
{
return $this->checklist;
}
To that object storage i want to be able to add objects of the class 'Checkobject' which has just two propeties: 'name' and 'checked'...
Within the controller of the class i have following code in the createAction:
$Kundenauftragliegtvor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('...\Kundentermine\Domain\Model\Checkobject');
$Kundenauftragliegtvor->setName('Kundenauftrag liegt vor');
$Kaufmnnisch->getChecklist()->attach($Kundenauftragliegtvor);
So basically when creating an object of that class i want to initially create the object $Kundenauftragliegtvor (of course later i want to add additional objects of that class, but thats another story)... BUT: When creating an object of the class Kaufmnnisch I get the following error:
Incorrect integer value: '' for column 'checklist' at row 1
It seems that attaching the object to the objectstorage 'checklist' seems to create the error in my MySQL database. I suspect that my TCA (specifically the part for the objectstorage) isn't correct:
'checklist' => [
'exclude' => true,
'label' => 'LLL:EXT:kundentermine/Resources/Private/Language/locallang_db.xlf:tx_kundentermine_domain_model_kaufmnnisch.checklist',
'config' => [
'type' => 'passthrough',
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
],
'default' => 0,
]
],
class Kaufmnnisch extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
public function __construct(){
$this->checklist = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* checklist
*
* @var Tx_Extbase_Persistence_ObjectStorage
* @lazy
*/
protected $checklist;
/**
* Returns the checklist
*
* @return Tx_Extbase_Persistence_ObjectStorage $checklist
*/
public function getChecklist()
{
return $this->checklist;
}
/**
* Sets the checklist
*
* @param Tx_Extbase_Persistence_ObjectStorage $checklist
* @return void
*/
public function setChecklist($checklist)
{
$this->checklist = $checklist;
}
/**
* Returns the boolean state of checklist
*
* @return bool
*/
public function isChecklist()
{
return $this->checklist;
}
To that object storage i want to be able to add objects of the class 'Checkobject' which has just two propeties: 'name' and 'checked'...
Within the controller of the class i have following code in the createAction:
$Kundenauftragliegtvor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('...\Kundentermine\Domain\Model\Checkobject');
$Kundenauftragliegtvor->setName('Kundenauftrag liegt vor');
$Kaufmnnisch->getChecklist()->attach($Kundenauftragliegtvor);
So basically when creating an object of that class i want to initially create the object $Kundenauftragliegtvor (of course later i want to add additional objects of that class, but thats another story)... BUT: When creating an object of the class Kaufmnnisch I get the following error:
Incorrect integer value: '' for column 'checklist' at row 1
It seems that attaching the object to the objectstorage 'checklist' seems to create the error in my MySQL database. I suspect that my TCA (specifically the part for the objectstorage) isn't correct:
'checklist' => [
'exclude' => true,
'label' => 'LLL:EXT:kundentermine/Resources/Private/Language/locallang_db.xlf:tx_kundentermine_domain_model_kaufmnnisch.checklist',
'config' => [
'type' => 'passthrough',
'items' => [
'1' => [
'0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
]
],
'default' => 0,
]
],