我有这个错误:遇到无效类型:'\TYPO3\Flow\Resource\Resource'
代码
控制器:
class Tx_PromConf_Controller_RegistrationController extends Tx_Extbase_MVC_Controller_ActionController {
/**
* Imports a passport
*
* @param Tx_PromConf_Domain_Model_Passport $passport The new passport
* @return void
*/
public function passportUploadAction(Tx_PromConf_Domain_Model_Passport $passport) {
$this->passportRepository->add($passport);
$this->forward('index');
}
}
模型
class Tx_PromConf_Domain_Model_Passport extends Tx_Extbase_DomainObject_AbstractEntity {
/**
* @var string
*/
protected $title;
/**
* @var \TYPO3\Flow\Resource\Resource
*/
protected $originalResource;
/**
* @param string $title
* @return void
*/
public function setTitle($title) {
$this->title = $title;
}
/**
* @return string
*/
public function getTitle() {
return $this->title;
}
/**
* @param \TYPO3\Flow\Resource\Resource $originalResource
* @return void
*/
public function setOriginalResource(\TYPO3\Flow\Resource\Resource $originalResource) {
$this->originalResource = $originalResource;
}
/**
* @return \TYPO3\Flow\Resource\Resource
*/
public function getOriginalResource() {
return $this->originalResource;
}
/**
* __construct
*
* @return void
*/
public function __construct() {
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
$this->setTitle('PassportScan');
}
/**
* Initializes all Tx_Extbase_Persistence_ObjectStorage properties.
*
* @return void
*/
protected function initStorageObjects() {
}
}
形式
<f:form action="passportUpload" controller="Registration" enctype="multipart/form-data"
object="{passport}" objectName="passport">
<br />
<div>
<f:translate key="tx_promconf_passport_upload.sentense" />
</div>
<br />
<div class="max-size">
<f:form.upload class="btn" name="originalResource" />
</div>
<br />
<br />
<div class="max-size">
<f:form.submit name="mySubmit" class="btn btn-l" value="<f:translate key='tx_promconf_passport_upload.ok' />" />
<input type="reset" class="btn btn-r" value="<f:translate key='tx_promconf_passport_upload.cancel' />" />
</div>
</f:form>