[TYPO3-mvc] Lost again or my problem with mapped tx_dam
Sebastian Fischer
typo3 at fischer.im
Thu Feb 4 15:44:40 CET 2010
On 04.02.2010 14:28, Sebastian Fischer wrote:
> Hi everyone,
>
> i need to fetch images out of dam and that's why puzzeled arount with it.
>
> My results so fare:
> - My mapping in TS
> persistence {
> classes {
> Tx_MyExt_Domain_Model_Dam {
> mapping {
> tableName = tx_dam
> }
> }
> Tx_MyExt_Domain_Model_DamCategory {
> mapping {
> tableName = tx_dam_cat
> }
> }
> }
> }
> - a simple model Tx_MyExt_Domain_Model_Dam with category attribute
> /**
> * @var
> Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_DamCategory>
> */
> protected $category;
>
> /**
> * Setter for category
> *
> * @param
> Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_DamCategory>
> * @return void
> */
> public function setCategory(Tx_Extbase_Persistence_ObjectStorage
> $category) {
> $this->category = $category;
> }
>
> /**
> * Getter for category
> *
> * @return
> Tx_Extbase_Persistence_ObjectStorage<Tx_MyExt_Domain_Model_DamCategory>
> */
> public function getCategory() {
> return $this->category;
> }
>
> - and a repository with following function:
> /**
> * Fetch images that contain given categories
> *
> * @param string
> * @return array
> */
> public function findByCategory($categoryUidList) {
> $query = $this->createQuery();
> $query->getQuerySettings()->setRespectStoragePage(FALSE);
>
> $uids = explode(',', $categoryUidList);
> $query->matching($query->equals('category', $uids));
>
> return $query->execute();
> }
>
> As you know category is a foreign table with mm table. But my query ends
> without result and i can't locate the problem. Is anyone around that has
> a solution?
>
> Greetings
> Sebastian
Ok after playing around with that i found out that the category get
loaded. In my view i can output the category/ies title. So my only
problem is, that i can't the constrains on category in my query.
So tx_dam and tx_dam_cat is already connected but i can't filter with it.
Greets
Sebastian
More information about the TYPO3-project-typo3v4mvc
mailing list