[TYPO3-mvc] Blog Example and Value Object question

Martin Kutschker masi-no at spam-typo3.org
Tue Dec 29 20:55:05 CET 2009


Jochen Rau schrieb:
> Hi Masi.
> 
> schrieb Martin Kutschker:
>> Would it be ok to add such a method to the blog example extension? I
>> could try the code myself and
>> offer patches. I guess that the questions we're asking now about the
>> example will be repeated, so
>> I'd be great if the answers are already provided.
> 
> Yes. That would be great. Thanks in advance.

Unfortunately I'm too stupid.

How do I access the post repository from the blog repository? Somehow I don't understand why not the
blog repository can get the findByTag() method.

class Tx_BlogExample_Domain_Repository_BlogRepository extends Tx_Extbase_Persistence_Repository {

	public functions findPostsByTag(Tx_BlogExample_Domain_Model_Tag $tag, $limit = 20) {
		$query = $this->queryFactory->create('Tx_BlogExample_Domain_Model_Post'); // Hack ?
		return $query->matching($query->equals('tag', $tag))
			->setOrderings(array('date' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING))
			->setLimit((integer)$limit)
			->execute();
	}

}

Masi


More information about the TYPO3-project-typo3v4mvc mailing list