Commit f04e48ab authored by Thomas Löffler's avatar Thomas Löffler

Fix issue with missing ObjectStorage and add author name to liked list

parent 1ff1aaec
Pipeline #6410 passed with stages
in 5 minutes and 59 seconds
...@@ -23,6 +23,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser ...@@ -23,6 +23,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function __construct() public function __construct()
{ {
parent::__construct();
$this->likedExtensions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->likedExtensions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
} }
...@@ -31,6 +32,9 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser ...@@ -31,6 +32,9 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/ */
public function getLikedExtensions(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage public function getLikedExtensions(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage
{ {
if ($this->likedExtensions === null) {
$this->likedExtensions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
return $this->likedExtensions; return $this->likedExtensions;
} }
...@@ -44,7 +48,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser ...@@ -44,7 +48,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function addLikedExtension(Extension $extension) public function addLikedExtension(Extension $extension)
{ {
if (!$this->likedExtensions->contains($extension)) { if (!$this->getLikedExtensions()->contains($extension)) {
$extension->increaseLikes(); $extension->increaseLikes();
$this->likedExtensions->attach($extension); $this->likedExtensions->attach($extension);
} }
...@@ -52,7 +56,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser ...@@ -52,7 +56,7 @@ class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
public function removeLikedExtension(Extension $extension) public function removeLikedExtension(Extension $extension)
{ {
if ($this->likedExtensions->contains($extension)) { if ($this->getLikedExtensions()->contains($extension)) {
$extension->decreaseLikes(); $extension->decreaseLikes();
$this->likedExtensions->detach($extension); $this->likedExtensions->detach($extension);
} }
......
...@@ -204,7 +204,8 @@ ...@@ -204,7 +204,8 @@
<f:for each="{likedExtensions}" as="extension"> <f:for each="{likedExtensions}" as="extension">
<tr> <tr>
<td class="text-middle"> <td class="text-middle">
<f:link.action controller="Extension" action="show" arguments="{extension: extension}">{extension.extKey}</f:link.action> <f:link.action controller="Extension" action="show" arguments="{extension: extension}">{extension.extKey}</f:link.action><br>
{extension.lastVersion.author.name}
</td> </td>
<td> <td>
<f:if condition="{extension.lastVersion.reviewState} != -1"> <f:if condition="{extension.lastVersion.reviewState} != -1">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment