Folgendes habe ich schon gemacht:
-Die Extension wurde zuerst mit dem Extension_builder erstellt
-es soill ein Objekt "Darlehen erzeugt werden
-dort hat es eine relation zum "Beantrager" der vom fe_users
-kommt, dieser soll dabei eben eine Datei mit hochladen knnen.
-Bis auf denn Dateiupload klappt alles, im Backend klappt auch alles.
Das Model :
class Beantrager extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
...der soll nun seinen "lohnausweis" hochladen knnen,
das Feld im Model Beantrager sieht so aus:
------------------------------------------
/**
* lohnausweis
* @var
\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $lohnausweis;
auch in diesem Model die "getter" und "setter", wobei es mir vor
allem auf das "hochladen" der Datei geht,
in diesem Projekt muss die Datei nur im Backend runtergeladen werden
knnen, nie im Frontend.
Also die Getter und Setter im Model des Beantrager:
---------------------------------------------------
/**
* Returns the lohnausweis
* @return
\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
$lohnausweis
*/
public function getLohnausweis() {
return $this->lohnausweis;
}
/**
* sets the lohnausweis
* @param
\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
$lohnausweis
* @return void
*/
public function setLohnausweis($lohnausweis) {
$this->lohnausweis = $lohnausweis;
}
Dann die Anpassung im TCA, damit klappt es im Backend schonmal mit
Dateiupload:
--------------------------------------------------------------------------------
'lohnausweis' => array(
'config' =>
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'file',
array(
'appearance' => array(
'createNewRelationLinkTitle' =>
'LLL:EXT:cms/locallang_ttc.xlf:media.addFileReference',
'collapseAll' => TRUE,
),
'maxitems' => 2,
'minitems' => 0
),
'doc,pdf'
)
),
Im Fluid Template:
--------------------
<f:form action="create" name="newDarlehen" object="{newDarlehen}"
enctype="multipart/form-data">
<f:form.upload property="beantragerDaten.lohnausweis" />
Das Mapping:
-----------
plugin.tx_extensionname{
persistence {
classes {
\TYPO3\Extensionname\Domain\Model\Beantrager{
mapping {
tableName = fe_users
recordType = tx_extensionname_domain_model_beantrager
columns {
lohnausweis.mapOnProperty = lohnausweis
}
}
}
}
}
}
Im Controller wo das neue Objekt "Darlehen" erstellt wird:
if ($this->arguments->hasArgument('newDarlehen')) {
$mvcPropertyMappingConfiguration =
\TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationBuilder::build('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\MvcPropertyMappingConfiguration');
$this->arguments->getArgument('newDarlehen')->injectPropertyMappingConfiguration($mvcPropertyMappingConfiguration);
$propertyMappingConfiguration =
$this->arguments->getArgument('newDarlehen')->getPropertyMappingConfiguration();
$propertyMappingConfiguration->forProperty('*')->allowAllProperties();
$propertyMappingConfiguration->forProperty('*')->allowCreationForSubProperty('*');
$propertyMappingConfiguration->forProperty('*')->forProperty('*')->allowAllProperties();
$propertyMappingConfiguration->allowProperties('*') ;
$this->arguments['newDarlehen']->getPropertyMappingConfiguration()->allowCreationForSubProperty('*');
$this->arguments['newDarlehen']->getPropertyMappingConfiguration()->allowModificationForSubProperty('*');
}
Wenn ich mit diesen Einstellungen das Objekt erzeugen mchte bekomme
ich die Fehlermeldung:
1297759968: Exception while property mapping at property path
"beantragerDaten.lohnausweis.name":
The identity property "Anleitung_HDClone_DE.pdf" is no UID.
mache ich dann noch folgendes in denn Cotroller des Darlehen :
$this->arguments->getArgument('newDarlehen')->getPropertyMappingConfiguration()->setTargetTypeForSubProperty('beantragerDaten.lohnausweis',
'array');
bekomme ich diese Fehlermeldung auf der ich nicht mehr wegkomme:
602160: Operand should contain 1 column(s): UPDATE fe_users SET
username='testuser', kinderbetruung='', s
chulkosten='',
lohnausweis=('Anleitung_HDClone_DE.pdf','application/pdf','/tmp/phpssQwcB','0','1455613'),
middle_name='', lockToDomain=''
tx_extbase_type='Tx_Extensionname_Beantrager' WHERE uid='550'
Versuche nun schon seit Tagen eine Lsung zu finden, und wre wirklich
fr jden Tipp sehr Dankbar.
Falls jemand das genau ansehen mchte wrde ich sofort einen Zugang
einrichten.
herzliche Grsse
Harald
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
_______________________________________________
TYPO3-german mailing list
TYPO3-german@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german