[TYPO3-mvc] Using repository inside an entity

Henrik Møller Rasmussen info at hmrdesign.dk
Sat Apr 24 13:53:38 CEST 2010


Hello,

I have some code that uses a repository inside an entity, it works, but 
is it not good practice?

--snip--

/**
  * Returns all items for sale in this category
  *
  * @return 
Tx_Extbase_Persistence_ObjectStorage<Tx_Dabmarket_Domain_Model_Item>
  */
public function getItemsForSale() {
	$this->itemRepository = 
t3lib_div::makeInstance('Tx_Dabmarket_Domain_Repository_ItemRepository');
	return $this->itemRepository->findForSaleByCategory($this);
}

--------


The more I get to play with extbase/fluid, the more I love it. But it 
takes some time to acquire some good practices.

- Henrik


More information about the TYPO3-project-typo3v4mvc mailing list