Hallo Zusammen
Ich habe eine Applikation, die nicht in der Datenbank persisitiert wird. Dazu werden die benötigten Check-Objekte in die Session gespeichert:
<?php
namespace ***\***\Domain\Model;
use TYPO3\FLOW3\Annotations as FLOW3;
/**
* @FLOW3\Scope(''session'')
*/
class Check {
/**
* The id
* @var integer
*/
protected $Id;
/**
* The host
* @var string
*/
protected $host;
...
/**
* Get the Check's id
*
* @return integer The Check's id
*/
public function getId() {
return $this->Id;
}
/**
* Sets this Check's id
*
* @FLOW3\Session(autoStart = true)
* @param integer $Id The Check's id
* @return void
*/
public function setId($Id) {
$this->Id = $Id;
}
/**
* Get the Check's host
*
* @return string The Check's host
*/
public function getHost() {
return $this->host;
}
/**
* Sets this Check's host
*
* @FLOW3\Session(autoStart = true)
* @param string $host The Check's host
* @return void
*/
public function setHost($host) {
$this->host = $host;
}
...
}
?>
Solange ich das Objekt in innerhalb meines Controllers als Instanzvariable des Controllers verwende, kann ich es Actionübergreifend nutzen.
<?php
namespace ***\***\Controller;
use TYPO3\FLOW3\Annotations as FLOW3;
use Symfony\Component\Yaml\Yaml as Yaml;
/**
* @FLOW3\Scope(''singleton'')
*/
class CheckController extends \TYPO3\FLOW3\Mvc\Controller\ActionController {
/**
* @FLOW3\Inject
* @var \***\***\Domain\Model\Check
*/
protected $check;
...
/**
* @var int
*/
protected $hostId;
/**
* Initialize action
*
* @return void
*/
public function initializeAction() {
$serverIp = explode('.', $this->request->getHttpRequest()->getClientIpAddress());
$this->hostId = $serverIp[3];
}
public function initializeView(\TYPO3\FLOW3\Mvc\View\ViewInterface $view) {
$this->view->assign('version', $package->getPackageMetaData()->getVersion());
$this->view->assign('hostId', $this->hostId);
}
/**
* Index action
*
* @return void
*/
public function indexAction() {
$this->check->setId(time());
$this->check->setHost($this->hostId);
...
$this->view->assign('check',$this->check);
}
...
}
?>
Sobald ich jedoch im Fluid das Objekt mittels link.action an einen andern Controller übergeben möchte, erhalte ich die Fehlermeldung, dass kein Persistentes Objekt gefunden werden konnte, was auch logisch ist, da es nicht in die Datenbank gespeichert wird.
<f:link.action action="checkInterpretation" controller="Admin" arguments="{check:check}">Check Auswerten</f:link.action>
Was muss ich tun, damit ich das in der Session gespeicherte Objekt an den andern Controller übergeben kann?
Wie kann ich alternativ das Objekt im andern Controller selbst aus der Session holen? Ich finde leider überall nur Tutorials dazu wie man etwas in eine Session speichert, aber nie, wie man es wieder herausbekommt!