I have written an extension based on TYPO3 version 9. I have now installed it in a TYPO3 version 10 system and everything seems to work fine. Only the show pages can not be opened anymore.
The error comes:
Cannot access protected property myname\myextension\Domain\Model\Country::$name
I do not understand the mistake. On the list page I use the country name normally. On the Show pages I do not use it at all. So it makes no sense why this should cause problems.
Here is my Show.html
<div class="card">
<h5 class="card-header" style="text-align: center">
{house.name}
</h5>
<div class="card-body" style="text-align: center">
<p class="card-text">
<f:link.external uri="{house.link}" target="_blank">{house.link}</f:link.external>
</p>
<h2>Rooms</h2>
<ul>
<f:for each="{house.room}" as="room">
<li>{room.name}</li>
</f:for>
</ul>
</div>
</div>
<f:link.action action="list" class="btn btn-primary">
BACK
</f:link.action>
My Controller
class HouseController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
............
............
/**
* @param House $house
*/
public function showAction(House $house)
{
$this->view->assign('house', $house);
}
As said before the complete code works fine on version 9, there must be some change in version 10 the problems.
Edit: Here is my Country Model
class Country extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* Country Name
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $name = '';
/**
* Returns the name
*
* @return string $name
*/
public function getName()
{
return $this->name;
}
/**
* Sets the name
*
* @param string $name
* @return void
*/
public function setName($name)
{
$this->name = $name;
}
}
And here my House Model (not all lines):
class House extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Countrie House
*
* @var \myname\myextension\Domain\Model\Country
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $country = null;
/**
* Returns the country
*
* @return \myname\myextension\Domain\Model\Country $country
*/
public function getCountry()
{
return $this->country;
}
/**
* Sets the country
*
* @param \myname\myextension\Domain\Model\Country $country
* @return void
*/
public function setCountry(\myname\myextension\Domain\Model\Country $country)
{
$this->country = $country;
}
}