Skip to content

Commit

Permalink
[TASK] Avoid object manager in post model
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed May 16, 2023
1 parent f5a9125 commit 127af4a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Classes/Domain/Model/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class Post extends AbstractEntity
Expand Down Expand Up @@ -375,8 +374,7 @@ public function getComments(): ObjectStorage
*/
public function getActiveComments()
{
return GeneralUtility::makeInstance(ObjectManager::class)
->get(CommentRepository::class)
return GeneralUtility::makeInstance(CommentRepository::class)
->findAllByPost($this);
}

Expand Down Expand Up @@ -542,8 +540,7 @@ public function getCrdateYear(): int
*/
public function getUri(): string
{
return GeneralUtility::makeInstance(ObjectManager::class)
->get(UriBuilder::class)
return GeneralUtility::makeInstance(UriBuilder::class)
->setCreateAbsoluteUri(true)
->setTargetPageUid($this->getUid())
->build();
Expand Down

0 comments on commit 127af4a

Please sign in to comment.