TYPO3 扩展 - 对象存储 NULL

TYPO3 Extension - Object Storage NULL

我正在为产品和消耗品(1:n 关系)编写 typo3 扩展程序。例如汽车(产品)和燃料、机油等(materials)。 这只是一个例子,所以在我的情况下其他汽车不需要燃料;)

所以我在 Patrik Lohbacher 的 simpleblog 示例附近创建了它。在这种情况下,您可以说 product=blog 和 material=post.

所以我的问题出在产品的展示视图上。我想查看此产品的 material,但它不起作用。在 {product} 的 f:debug 中,我可以正确地看到所有 material,而且在后端,一切似乎都很好。

fdebug view of product

但是当我试图在 fdebug 中看到 {product.materials} 时,有一个 NULL。

我忘记了什么?可能是什么问题?


    MyEXTENSION\MyExtension\Domain\Model\Produktprototypepersistent entity (uid=1, pid=39)
       crdate => '1494240491' (10 chars)
       crfromid => '2' (1 chars)
       crfromusername => 'hans' (4 chars)
       crfromfirstname => 'Hans' (4 chars)
       crfromlastname => 'Hanssen' (7 chars)
       updatefromid => '0' (1 chars)
       updatefromusername => '' (0 chars)
       updatefromfirstname => '' (0 chars)
       updatefromlastname => '' (0 chars)
       tstamp => '1494240524' (10 chars)
       bezeichnung => 'test1' (5 chars)
       hersteller => 'hersteller1' (11 chars)
       warengruppe => 'wg1' (3 chars)
       tnutzungsdauer => 0 (integer)
       preis => 0 (double)
       miete => 0 (double)
       abschreibungsart => 'linear' (6 chars)
       abschreibungsdauer => 0 (integer)
       geraeteentsorgung => 0 (double)
       sonstigekosten => 0 (double)
       montage => 0 (double)
       itanbindung => 0 (double)
       geraeteabnahme => 0 (double)
       mageraeteeinweisung => 0 (double)
       gewaehrleistungsfrist => 0 (integer)
       softwareupdates => 0 (double)
       softwareupdateturnus => 'nicht gefordert' (15 chars)
       stkturnus => 'nicht gefordert' (15 chars)
       stkprodurchfuehrung => 0 (double)
       mtkturnus => 'nicht gefordert' (15 chars)
       mtkprodurchfuehrung => 0 (double)
       dguvv3turnus => 'nicht gefordert' (15 chars)
       dguvv3produrchfuehrung => 0 (double)
       konstanzpruefungturnus => 'monatlich' (9 chars)
       konstanzpruefungprodurchfuehrung => 0 (double)
       messpruefungturnus => 'monatlich' (9 chars)
       messpruefungprodurchfuehrung => 0 (double)
       jaehrlichepreisanpassung => 0 (integer)
       materials => TYPO3\CMS\Extbase\Persistence\ObjectStorageprototypeobject (1 items)
       uid => 1 (integer)
       _localizedUid => 1 (integer)modified
       _languageUid => 0 (integer)modified
       _versionedUid => 1 (integer)modified
       pid => 39 (integer)
</pre>

是的,我知道它应该是 'product' 而不是 'produkt' ;)


    /**
     * Returns the materials
     * 
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyEXTENSION\MyExtension\Domain\Model\Material> $materials
     */
    public function getMaterials()
    {
      return $this->materials();
    }</p>

<pre><code>/**
 * Sets the materials
 * 
 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyEXTENSION\MyExtension\Domain\Model\Material> $materials
 * @return void
 */
public function setMaterials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $materials)
{
  $this->materials = $materials;
}

Produkt.php


namespace MyEXTENSION\MyExtension\Domain\Model;</p>

<p>/***************************************************************
 *
 *  Copyright notice
 *
 *  (c) 2017 Sebastian Christoph , HELIOS IT
 *
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  The GNU General Public License can be found at
 *  <a href="http://www.gnu.org/copyleft/gpl.html" rel="nofollow noreferrer">http://www.gnu.org/copyleft/gpl.html</a>.
 *
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/</p>

<p>/**
 * Produkt
 */
class Produkt extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{</p>

<pre><code>/**
 * crdate
 * 
 * @var string
 */
 protected $crdate;  

 /**
  * crfromid
  * 
  * @var string
  */
 protected $crfromid;

 /**
  * crfromusername
  * 
  * @var string
  */
 protected $crfromusername;

 /**
  * crfromfirstname
  * 
  * @var string
  */
 protected $crfromfirstname;     

 /**
  * crfromlastname
  * 
  * @var string
  */
 protected $crfromlastname;     

 /**
  * updatefromid
  * 
  * @var string
  */
 protected $updatefromid;

 /**
  * updatefromusername
  * 
  * @var string
  */
 protected $updatefromusername;

 /**
  * updatefromfirstname
  * 
  * @var string
  */
 protected $updatefromfirstname;

 /**
  * updatefromlastname
  * 
  * @var string
  */
 protected $updatefromlastname;     

/**
 * tstamp
 * 
 * @var string
 */
 protected $tstamp;    

/**
 * bezeichnung
 *
 * @var string
 * @validate NotEmpty
 */
protected $bezeichnung = '';

/**
 * hersteller
 *
 * @var string
 * @validate NotEmpty
 */
protected $hersteller = '';

/**
 * warengruppe
 *
 * @var string
 * @validate NotEmpty
 */
protected $warengruppe = '';

/**
 * tnutzungsdauer
 *
 * @var int
 */
protected $tnutzungsdauer = 0;

/**
 * preis
 *
 * @var float
 */
protected $preis = 0.0;

/**
 * miete
 *
 * @var float
 */
protected $miete = 0.0;

/**
 * abschreibungsart
 *
 * @var string
 */
protected $abschreibungsart = '';

/**
 * abschreibungsdauer
 *
 * @var int
 */
protected $abschreibungsdauer = 0;

/**
 * geraeteentsorgung
 *
 * @var float
 */
protected $geraeteentsorgung = 0.0;

/**
 * sonstigekosten
 *
 * @var float
 */
protected $sonstigekosten = 0.0;

/**
 * montage
 *
 * @var float
 */
protected $montage = 0.0;

/**
 * itanbindung
 *
 * @var float
 */
protected $itanbindung = 0.0;

/**
 * geraeteabnahme
 *
 * @var float
 */
protected $geraeteabnahme = 0.0;

/**
 * mageraeteeinweisung
 *
 * @var float
 */
protected $mageraeteeinweisung = 0.0;

/**
 * gewaehrleistungsfrist
 *
 * @var int
 */
protected $gewaehrleistungsfrist = 0;

/**
 * softwareupdates
 *
 * @var float
 */
protected $softwareupdates = 0.0;

/**
 * softwareupdateturnus
 *
 * @var string
 */
protected $softwareupdateturnus = '';

/**
 * stkturnus
 *
 * @var string
 */
protected $stkturnus = '';

/**
 * stkprodurchfuehrung
 *
 * @var float
 */
protected $stkprodurchfuehrung = 0.0;

/**
 * mtkturnus
 *
 * @var string
 */
protected $mtkturnus = '';

/**
 * mtkprodurchfuehrung
 *
 * @var float
 */
protected $mtkprodurchfuehrung = 0.0;

/**
 * dguvv3turnus
 *
 * @var string
 */
protected $dguvv3turnus = '';

/**
 * dguvv3produrchfuehrung
 *
 * @var float
 */
protected $dguvv3produrchfuehrung = 0.0;

/**
 * konstanzpruefungturnus
 *
 * @var string
 */
protected $konstanzpruefungturnus = '';

/**
 * konstanzpruefungprodurchfuehrung
 *
 * @var float
 */
protected $konstanzpruefungprodurchfuehrung = 0.0;

/**
 * messpruefungturnus
 *
 * @var string
 */
protected $messpruefungturnus = '';

/**
 * messpruefungprodurchfuehrung
 *
 * @var float
 */
protected $messpruefungprodurchfuehrung = 0.0;

/**
 * jaehrlichepreisanpassung
 *
 * @var int
 */
protected $jaehrlichepreisanpassung = 0;

/**
 * Produkt Material
 * 
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyEXTENSION\MyExtension\Domain\Model\Material>
 */
protected $materials = null;

/**
 * __construct
 */
public function __construct() 
{
  $this->initStorageObjects();
}

/**
 * Initializes all ObjectStorage properties
 * 
 * @return void
 */
protected function initStorageObjects()
{
  $this->materials = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}

/**
 * Returns the crdate
 * 
 * @return string $crdate
 */
public function getCrdate() {
  return $this->crdate;
}

/**
 * Sets the crdate
 * 
 * @param string $crdate
 * @return void
 */
public function setCrdate($crdate) {
  $this->crdate = $crdate;
}

/**
 * Returns the crfromid
 * 
 * @return string $crfromid
 */
public function getCrfromid() {
  return $this->crfromid;
}

/**
 * Sets the crfromid
 * 
 * @param string $crfromid
 * @return void
 */
public function setCrfromid($crfromid) {
  $this->crfromid = $crfromid;
}

/** * Returns the crfromusername * * @return string $crfromusername */ public function getCrfromusername() { return $this->crfromusername; }

/**
 * Sets the crfromusername
 * 
 * @param string $crfromusername
 * @return void
 */
public function setCrfromusername($crfromusername) {
  $this->crfromusername = $crfromusername;
}   

/** * Returns the crfromlastname * * @return string $crfromlastname */ public function getCrfromlastname() { return $this->crfromlastname; }

/**
 * Sets the crfromlastname
 * 
 * @param string $crfromlastname
 * @return void
 */
public function setCrfromlastname($crfromlastname) {
  $this->crfromlastname = $crfromlastname;
}   

/** * Returns the crfromfirstname * * @return string $crfromfirstname */ public function getCrfromfirstname() { return $this->crfromfirstname; }

/**
 * Sets the crfromfirstname
 * 
 * @param string $crfromfirstname
 * @return void
 */
public function setCrfromfirstname($crfromfirstname) {
  $this->crfromfirstname = $crfromfirstname;
}    

/**
 * Returns the updatefromid
 * 
 * @return string $updatefromid
 */
public function getUpdatefromid() {
  return $this->updatefromid;
}

/**
 * Sets the updatefromid
 * 
 * @param string $updatefromid
 * @return void
 */
public function setUpdatefromid($updatefromid) {
  $this->updatefromid = $updatefromid;
}

/**
 * Returns the updatefromusername
 * 
 * @return string $updatefromusername
 */
public function getUpdatefromusername() {
  return $this->updatefromusername;
}

/**
 * Sets the updatefromusername
 * 
 * @param string $updatefromusername
 * @return void
 */
public function setUpdatefromusername($updatefromusername) {
  $this->updatefromusername = $updatefromusername;
}   

/**
 * Returns the updatefromlastname
 * 
 * @return string $updatefromlastname
 */
public function getUpdatefromlastname() {
  return $this->updatefromlastname;
}

/**
 * Sets the updatefromlastname
 * 
 * @param string $updatefromlastname
 * @return void
 */
public function setUpdatefromlastname($updatefromlastname) {
  $this->updatefromlastname = $updatefromlastname;
}   

/**
 * Returns the updatefromfirstname
 * 
 * @return string $updatefromfirstname
 */
public function getUpdatefromfirstname() {
  return $this->updatefromfirstname;
}

/**
 * Sets the updatefromfirstname
 * 
 * @param string $updatefromfirstname
 * @return void
 */
public function setUpdatefromfirstname($updatefromfirstname) {
  $this->updatefromfirstname = $updatefromfirstname;
}    

/**
 * Returns the tstamp
 * 
 * @return string tstamp
 */
public function getTstamp() {
  return $this->tstamp;
}

/**
 * Sets the tstamp
 * 
 * @param string tstamp
 * @return void
 */
public function setTstamp($tstamp) {
  $this->tstamp = $tstamp;
}    

/**
 * Returns the bezeichnung
 *
 * @return string bezeichnung
 */
public function getBezeichnung()
{
    return $this->bezeichnung;
}

/**
 * Sets the bezeichnung
 *
 * @param string $bezeichnung
 * @return void
 */
public function setBezeichnung($bezeichnung)
{
    $this->bezeichnung = $bezeichnung;
}

/**
 * Returns the hersteller
 *
 * @return string $hersteller
 */
public function getHersteller()
{
    return $this->hersteller;
}

/**
 * Sets the hersteller
 *
 * @param string $hersteller
 * @return void
 */
public function setHersteller($hersteller)
{
    $this->hersteller = $hersteller;
}

/**
 * Returns the warengruppe
 *
 * @return string $warengruppe
 */
public function getWarengruppe()
{
    return $this->warengruppe;
}

/**
 * Sets the warengruppe
 *
 * @param string $warengruppe
 * @return void
 */
public function setWarengruppe($warengruppe)
{
    $this->warengruppe = $warengruppe;
}

/**
 * Returns the tnutzungsdauer
 *
 * @return int $tnutzungsdauer
 */
public function getTnutzungsdauer()
{
    return $this->tnutzungsdauer;
}

/**
 * Sets the tnutzungsdauer
 *
 * @param int $tnutzungsdauer
 * @return void
 */
public function setTnutzungsdauer($tnutzungsdauer)
{
    $this->tnutzungsdauer = $tnutzungsdauer;
}

/**
 * Returns the preis
 *
 * @return float $preis
 */
public function getPreis()
{
    return $this->preis;
}

/**
 * Sets the preis
 *
 * @param float $preis
 * @return void
 */
public function setPreis($preis)
{
    $this->preis = $preis;
}

/**
 * Returns the miete
 *
 * @return float $miete
 */
public function getMiete()
{
    return $this->miete;
}

/**
 * Sets the miete
 *
 * @param float $miete
 * @return void
 */
public function setMiete($miete)
{
    $this->miete = $miete;
}

/**
 * Returns the abschreibungsart
 *
 * @return string $abschreibungsart
 */
public function getAbschreibungsart()
{
    return $this->abschreibungsart;
}

/**
 * Sets the abschreibungsart
 *
 * @param string $abschreibungsart
 * @return void
 */
public function setAbschreibungsart($abschreibungsart)
{
    $this->abschreibungsart = $abschreibungsart;
}

/**
 * Returns the abschreibungsdauer
 *
 * @return int $abschreibungsdauer
 */
public function getAbschreibungsdauer()
{
    return $this->abschreibungsdauer;
}

/**
 * Sets the abschreibungsdauer
 *
 * @param int $abschreibungsdauer
 * @return void
 */
public function setAbschreibungsdauer($abschreibungsdauer)
{
    $this->abschreibungsdauer = $abschreibungsdauer;
}

/**
 * Returns the geraeteentsorgung
 *
 * @return float $geraeteentsorgung
 */
public function getGeraeteentsorgung()
{
    return $this->geraeteentsorgung;
}

/**
 * Sets the geraeteentsorgung
 *
 * @param float $geraeteentsorgung
 * @return void
 */
public function setGeraeteentsorgung($geraeteentsorgung)
{
    $this->geraeteentsorgung = $geraeteentsorgung;
}

/**
 * Returns the sonstigekosten
 *
 * @return float $sonstigekosten
 */
public function getSonstigekosten()
{
    return $this->sonstigekosten;
}

/**
 * Sets the sonstigekosten
 *
 * @param float $sonstigekosten
 * @return void
 */
public function setSonstigekosten($sonstigekosten)
{
    $this->sonstigekosten = $sonstigekosten;
}

/**
 * Returns the montage
 *
 * @return float $montage
 */
public function getMontage()
{
    return $this->montage;
}

/**
 * Sets the montage
 *
 * @param float $montage
 * @return void
 */
public function setMontage($montage)
{
    $this->montage = $montage;
}

/**
 * Returns the itanbindung
 *
 * @return float $itanbindung
 */
public function getItanbindung()
{
    return $this->itanbindung;
}

/**
 * Sets the itanbindung
 *
 * @param float $itanbindung
 * @return void
 */
public function setItanbindung($itanbindung)
{
    $this->itanbindung = $itanbindung;
}

/**
 * Returns the geraeteabnahme
 *
 * @return float $geraeteabnahme
 */
public function getGeraeteabnahme()
{
    return $this->geraeteabnahme;
}

/**
 * Sets the geraeteabnahme
 *
 * @param float $geraeteabnahme
 * @return void
 */
public function setGeraeteabnahme($geraeteabnahme)
{
    $this->geraeteabnahme = $geraeteabnahme;
}

/**
 * Returns the mageraeteeinweisung
 *
 * @return float $mageraeteeinweisung
 */
public function getMageraeteeinweisung()
{
    return $this->mageraeteeinweisung;
}

/**
 * Sets the mageraeteeinweisung
 *
 * @param float $mageraeteeinweisung
 * @return void
 */
public function setMageraeteeinweisung($mageraeteeinweisung)
{
    $this->mageraeteeinweisung = $mageraeteeinweisung;
}

/**
 * Returns the gewaehrleistungsfrist
 *
 * @return int $gewaehrleistungsfrist
 */
public function getGewaehrleistungsfrist()
{
    return $this->gewaehrleistungsfrist;
}

/**
 * Sets the gewaehrleistungsfrist
 *
 * @param int $gewaehrleistungsfrist
 * @return void
 */
public function setGewaehrleistungsfrist($gewaehrleistungsfrist)
{
    $this->gewaehrleistungsfrist = $gewaehrleistungsfrist;
}

/**
 * Returns the softwareupdates
 *
 * @return float $softwareupdates
 */
public function getSoftwareupdates()
{
    return $this->softwareupdates;
}

/**
 * Sets the softwareupdates
 *
 * @param float $softwareupdates
 * @return void
 */
public function setSoftwareupdates($softwareupdates)
{
    $this->softwareupdates = $softwareupdates;
}

/**
 * Returns the softwareupdateturnus
 *
 * @return string $softwareupdateturnus
 */
public function getSoftwareupdateturnus()
{
    return $this->softwareupdateturnus;
}

/**
 * Sets the softwareupdateturnus
 *
 * @param string $softwareupdateturnus
 * @return void
 */
public function setSoftwareupdateturnus($softwareupdateturnus)
{
    $this->softwareupdateturnus = $softwareupdateturnus;
}

/**
 * Returns the stkturnus
 *
 * @return string $stkturnus
 */
public function getStkturnus()
{
    return $this->stkturnus;
}

/**
 * Sets the stkturnus
 *
 * @param string $stkturnus
 * @return void
 */
public function setStkturnus($stkturnus)
{
    $this->stkturnus = $stkturnus;
}

/**
 * Returns the stkprodurchfuehrung
 *
 * @return float $stkprodurchfuehrung
 */
public function getStkprodurchfuehrung()
{
    return $this->stkprodurchfuehrung;
}

/**
 * Sets the stkprodurchfuehrung
 *
 * @param float $stkprodurchfuehrung
 * @return void
 */
public function setStkprodurchfuehrung($stkprodurchfuehrung)
{
    $this->stkprodurchfuehrung = $stkprodurchfuehrung;
}

/**
 * Returns the mtkturnus
 *
 * @return string $mtkturnus
 */
public function getMtkturnus()
{
    return $this->mtkturnus;
}

/**
 * Sets the mtkturnus
 *
 * @param string $mtkturnus
 * @return void
 */
public function setMtkturnus($mtkturnus)
{
    $this->mtkturnus = $mtkturnus;
}

/**
 * Returns the mtkprodurchfuehrung
 *
 * @return float $mtkprodurchfuehrung
 */
public function getMtkprodurchfuehrung()
{
    return $this->mtkprodurchfuehrung;
}

/**
 * Sets the mtkprodurchfuehrung
 *
 * @param float $mtkprodurchfuehrung
 * @return void
 */
public function setMtkprodurchfuehrung($mtkprodurchfuehrung)
{
    $this->mtkprodurchfuehrung = $mtkprodurchfuehrung;
}

/**
 * Returns the dguvv3turnus
 *
 * @return string $dguvv3turnus
 */
public function getDguvv3turnus()
{
    return $this->dguvv3turnus;
}

/**
 * Sets the dguvv3turnus
 *
 * @param string $dguvv3turnus
 * @return void
 */
public function setDguvv3turnus($dguvv3turnus)
{
    $this->dguvv3turnus = $dguvv3turnus;
}

/**
 * Returns the dguvv3produrchfuehrung
 *
 * @return float $dguvv3produrchfuehrung
 */
public function getDguvv3produrchfuehrung()
{
    return $this->dguvv3produrchfuehrung;
}

/**
 * Sets the dguvv3produrchfuehrung
 *
 * @param float $dguvv3produrchfuehrung
 * @return void
 */
public function setDguvv3produrchfuehrung($dguvv3produrchfuehrung)
{
    $this->dguvv3produrchfuehrung = $dguvv3produrchfuehrung;
}

/**
 * Returns the konstanzpruefungturnus
 *
 * @return string $konstanzpruefungturnus
 */
public function getKonstanzpruefungturnus()
{
    return $this->konstanzpruefungturnus;
}

/**
 * Sets the konstanzpruefungturnus
 *
 * @param string $konstanzpruefungturnus
 * @return void
 */
public function setKonstanzpruefungturnus($konstanzpruefungturnus)
{
    $this->konstanzpruefungturnus = $konstanzpruefungturnus;
}

/**
 * Returns the konstanzpruefungprodurchfuehrung
 *
 * @return float $konstanzpruefungprodurchfuehrung
 */
public function getKonstanzpruefungprodurchfuehrung()
{
    return $this->konstanzpruefungprodurchfuehrung;
}

/**
 * Sets the konstanzpruefungprodurchfuehrung
 *
 * @param float $konstanzpruefungprodurchfuehrung
 * @return void
 */
public function setKonstanzpruefungprodurchfuehrung($konstanzpruefungprodurchfuehrung)
{
    $this->konstanzpruefungprodurchfuehrung = $konstanzpruefungprodurchfuehrung;
}

/**
 * Returns the messpruefungturnus
 *
 * @return string $messpruefungturnus
 */
public function getMesspruefungturnus()
{
    return $this->messpruefungturnus;
}

/**
 * Sets the messpruefungturnus
 *
 * @param string $messpruefungturnus
 * @return void
 */
public function setMesspruefungturnus($messpruefungturnus)
{
    $this->messpruefungturnus = $messpruefungturnus;
}

/**
 * Returns the messpruefungprodurchfuehrung
 *
 * @return float $messpruefungprodurchfuehrung
 */
public function getMesspruefungprodurchfuehrung()
{
    return $this->messpruefungprodurchfuehrung;
}

/**
 * Sets the messpruefungprodurchfuehrung
 *
 * @param float $messpruefungprodurchfuehrung
 * @return void
 */
public function setMesspruefungprodurchfuehrung($messpruefungprodurchfuehrung)
{
    $this->messpruefungprodurchfuehrung = $messpruefungprodurchfuehrung;
}

/**
 * Returns the jaehrlichepreisanpassung
 *
 * @return int $jaehrlichepreisanpassung
 */
public function getJaehrlichepreisanpassung()
{
    return $this->jaehrlichepreisanpassung;
}

/**
 * Sets the jaehrlichepreisanpassung
 *
 * @param int $jaehrlichepreisanpassung
 * @return void
 */
public function setJaehrlichepreisanpassung($jaehrlichepreisanpassung)
{
    $this->jaehrlichepreisanpassung = $jaehrlichepreisanpassung;
}

/**
 * Adds a Material
 * 
 * @param \MyEXTENSION\MyExtension\Domain\Model\Material $material
 * @return void
 */
public function addMaterial(\MyEXTENSION\MyExtension\Domain\Model\Material $material)
{
  $this->materials->attach($material);
}

/**
 * Removes a material
 * 
 * @param \MyEXTENSION\MyExtension\Domain\Model\Material $materialToRemove
 * The Material to be removed
 * @return void
 */
public function removeMaterial(\MyEXTENSION\MyExtension\Domain\Model\Material $materialToRemove)
{
  $this->materials->detach($materialToRemove);
}

/**
 * Returns the materials
 * 
 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyEXTENSION\MyExtension\Domain\Model\Material> $materials
 */
public function getMaterials()
{
  return $this->materials();
}

/**
 * Sets the materials
 * 
 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\MyEXTENSION\MyExtension\Domain\Model\Material> $materials
 * @return void
 */
public function setMaterials(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $materials)
{
  $this->materials = $materials;
}

}

(已更新以反映讨论状态)

第 1138 行应为:

return $this->materials;