I'm trying to add a new Powermail field property as explained here and to get the value after a formular is submitted using a Finisher
The new property can be used in TYPO3 Backend without any problem and is shown in the Database, but there seems to be a problem with the mapping of the Domain Model as I can't see the new added field property when using my Finisher (and for instance using a "var_dump" on the "Mail"-Class).
ext_tables.sql
CREATE TABLE tx_powermail_domain_model_field (
my_new_property varchar(255) DEFAULT '' NOT NULL
);
ext_tables.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tx_powermail_domain_model_field', array(
'my_new_property' => array(
'exclude' => 1,
'label' => 'Mapping',
'config' => array(
'type' => 'select',
'items' => array(
array('none', ''),
array('test1', 'test1'),
array('test2', 'test2'),
),
),
)
));
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tx_powermail_domain_model_field',
'--div--;MyNewTab,my_new_property'
);
setup.txt
config.tx_extbase {
persistence {
classes {
In2code\Powermail\Domain\Model\Form {
subclasses {
0 = TYPO3\Myextension\Domain\Model\Form
}
}
In2code\Powermail\Domain\Model\Page {
subclasses {
0 = TYPO3\Myextension\Domain\Model\Page
}
}
In2code\Powermail\Domain\Model\Field {
subclasses {
0 = TYPO3\Myextension\Domain\Model\Field
}
}
TYPO3\Myextension\Domain\Model\Form {
mapping {
tableName = tx_powermail_domain_model_form
}
}
TYPO3\Myextension\Domain\Model\Page {
mapping {
tableName = tx_powermail_domain_model_page
}
}
TYPO3\Myextension\Domain\Model\Field {
mapping {
tableName = tx_powermail_domain_model_field
}
}
}
objects {
In2code\Powermail\Domain\Repository\FormRepository.className = TYPO3\Myextension\Domain\Repository\FormRepository
}
}
}
//Finisher
plugin.tx_powermail.settings.setup {
finishers {
1 {
class = TYPO3\Myextension\Finisher\MyNewFinisher
}
}
}
Field.php
<?php
namespace TYPO3\Myextension\Domain\Model;
/**
* Class Field
*
* @package TYPO3\Myextension\Domain\Model
*/
class Field extends \In2code\Powermail\Domain\Model\Field
{
/**
* myNewProperty
*
* @var string $myNewProperty
*/
protected $myNewProperty;
/**
* @return string
*/
public function getMyNewProperty()
{
return $this->myNewProperty;
}
/**
* @param string $myNewProperty
*
* @return void
*/
public function setMyNewProperty($myNewProperty)
{
$this->myNewProperty = $myNewProperty;
}
}
Page.php
<?php
namespace TYPO3\Myextension\Domain\Model;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Class Page
* @package TYPO3\Myextension\Domain\Model
*/
class Page extends \In2code\Powermail\Domain\Model\Page
{
/**
* Powermail Fields
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\Myextension\Domain\Model\Field>
*/
protected $fields = null;
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $fields
* @return void
*/
public function setFields($fields)
{
$this->fields = $fields;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getFields()
{
return $this->fields;
}
}
Form.php
<?php
namespace TYPO3\Myextension\Domain\Model;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Class Form
* @package TYPO3\Myextension\Domain\Model
*/
class Form extends \In2code\Powermail\Domain\Model\Form
{
/**
* pages
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\Myextension\Domain\Model\Page>
*/
protected $pages;
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $pages
* @return void
*/
public function setPages($pages)
{
$this->pages = $pages;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getPages()
{
return $this->pages;
}
}
FormRepository.php
<?php
namespace TYPO3\Myextension\Domain\Repository;
/**
* Class FormRepository
*
* @package TYPO3\Myextension\Domain\Repository
*/
class FormRepository extends \In2code\Powermail\Domain\Repository\FormRepository
{
}
Just for reference the Finisher class, where I'm trying to get the new property. When I'm var dumping the "Mail", I only get the standard Powermail Fields, without my new property.
MyNewFinisher
<?php
namespace TYPO3\Myextension\Finisher;
use In2code\Powermail\Domain\Model\Mail;
use In2code\Powermail\Finisher\AbstractFinisher;
class MyNewFinisher extends AbstractFinisher
{
/**
* @var Mail
*/
protected $mail;
/**
* @var array
*/
protected $configuration;
/**
* @var array
*/
protected $settings;
/**
* MyFinisher
*
* @return void
*/
public function myFinisher()
{
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->getMail());die();
}
}
Sorry for the long description... Any help is welcome :)