[TYPO3-mvc] Typoscript Configuration -> pages and sys_domain with a 1:n relation

KimPixel kimpixel+typo3v4mvc at googlemail.com
Wed May 25 12:55:35 CEST 2011


Hallo List Members

do somebody know how to setup the persistence layer with typoscript in
setup.txt to bind the tables "pages" and "sys_domains" with a 1:n DB
Relation?
dont' want to modify the TCA.

I will get an Object of pages with an attribute "domains" of type
Tx_Extbase_Persistence_ObjectStorage.
But how to setup this? the sys_domains are connected with the pid with
the pages.




setup.txt:
******************************
module.tx_myextkey
    persistence {
        classes {
            Tx_MyExtkey_Domain_Model_Page {
                mapping {
                    tableName = pages
                    columns {
                    }
                }
            }

            Tx_MyExtkey_Domain_Model_Domain {
                mapping {
                    tableName = sys_domains
                    columns {

                    }

                }
            }
        }
    }
}
******************************

Page.php
**********************************

class Tx_MyExtkey_Domain_Model_Page extends
Tx_Extbase_DomainObject_AbstractEntity {

    /**
     * domains
     * @var Tx_Extbase_Persistence_ObjectStorage<Tx_StrabagMicrosites_Domain_Model_Domain>
     */
    protected $domains;

	/**
	 * __construct
	 *
	 * @return void
	 */
	public function __construct() {
		$this->initStorageObjects();
	}

	/**
	 * Initializes all Tx_Extbase_Persistence_ObjectStorage properties.
	 *
	 * @return void
	 */
	protected function initStorageObjects() {
		$this->domains = new Tx_Extbase_Persistence_ObjectStorage();
	}

    /**
     * Setter for domains
     *
     * @param Tx_Extbase_Persistence_ObjectStorage<Tx_StrabagMicrosites_Domain_Model_Domain>
$domains domains
     * @return void
     */
    public function setDomains($domains)
    {
        $this->domains = $domains;
    }
    /**
     * Getter for domains
     *
     * @return Tx_Extbase_Persistence_ObjectStorage<Tx_StrabagMicrosites_Domain_Model_Domain>
$domains
     */
    public function getDomains()
    {
        return $this->domains;
    }
}


More information about the TYPO3-project-typo3v4mvc mailing list