Last active
December 19, 2015 21:39
-
-
Save langhard/6022021 to your computer and use it in GitHub Desktop.
TYPO3-CMS - Extbase - Repository - Sorting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blog extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity | |
/** | |
* blogRepository | |
* | |
* @var \ChGreenBanana\Famoca\Domain\Repository\PostRepository | |
* @inject | |
*/ | |
protected $postRepository; | |
/** | |
* Returns the posts | |
* | |
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ChGreenBanana\Famoca\Domain\Model\Post> $posts | |
*/ | |
public function getPosts() { | |
return $this->postRepository->findByBlog($this); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { | |
/** | |
* defaultOrderings | |
* | |
* @var array | |
*/ | |
protected $defaultOrderings = array( | |
'date' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment