[TYPO3-mvc] Problem inline parent relation to records of same table

Jochen Rieger j.rieger at connecta.ag
Fri Sep 14 18:38:41 CEST 2012


Hey mvc masters,

following situation:

- Documents have attachments that are also Document Objects
- based on DAM (using extbase_dam)


Everything works fine. IRRE TCA config is working perfectly in the 
backend. Documents will be retrieved from Database. Just the Child 
Records aka attachments won't get fetched.

The debug ViewHelper will output:

attachments => Tx_Extbase_Persistence_LazyObjectStorageprototype object (empty)


So - here is the setup:


1) Mapping in TS persistence part:

Tx_MyDoc_Domain_Model_Document {
  mapping {
    tableName = tx_dam
    recordType =

    columns {
      parent_id.mapOnProperty = attachments
    }
…
}



2) Important part of TCA config for tx_dam.parent_id:

type' => 'inline',
'foreign_table' => 'tx_dam',
'foreign_field' => 'parent_id',



3) The Model

class Tx_MyDoc_Domain_Model_Document
   extends Tx_ExtbaseDam_Domain_Model_Dam {

   /**
     * Attachments
     * @var 
Tx_Extbase_Persistence_ObjectStorage<Tx_BviDoc_Domain_Model_Document>
     *      @lazy
     */
    protected $attachments;

  /**
     * Getter for Attachments
     *
     * @return 
Tx_Extbase_Persistence_ObjectStorage<Tx_BviDoc_Domain_Model_Document> 
$attachments
      */
	public function getAttachments() {
		return $this->attachments;
	}

	/**
	 * Setter for Attachments
	 *
	 * @param 
Tx_Extbase_Persistence_ObjectStorage<Tx_BviDoc_Domain_Model_Document> 
$attachments
	 * @return void
	 */
	public function setAttachments(Tx_Extbase_Persistence_ObjectStorage 
$attachments) {
		$this->attachments = $attachments;
	}
}


Any ideas what could be wrong? Is there a problem when using a tree 
structure like this (parent_id as relation to records in the same 
table)?

Kind regards,
Jochen



More information about the TYPO3-project-typo3v4mvc mailing list