[TYPO3-mvc] mm relation, get only one objected instead all associated

Manfred Rutschmann manfred.rutschmann at revier.de
Wed Sep 15 13:54:23 CEST 2010


hi list,

i have some problems for understand some things with mm related objects.

i have this tables:

station {
	uid
	title
}

fahrzeug {
	uid
	title
	stationsid
}

fahrzeug_station_mm {
	uid_local
	uid_foreign
}

in fahrzeug can i assign some stations, for example 4 pieces. in my
fahrzeug object can i get the one station title by
{fahrzeug.stationsid.title}.

The {fahrzeug.stationsid} is a object, but this must be an array where all
associated objects are stored in. Here is my model fahrzeug with the
station part. What i have todo? Must i crate a own property and get the
associated objects form a own repository method by hand?

Thx and regards Manfred

class Tx_RkCamperchecker_Domain_Model_Fahrzeug extends
Tx_Extbase_DomainObject_AbstractEntity {

   
    /**
     * stationsid
     * @var Tx_RkCamperchecker_Domain_Model_Station	$stationsid	stationsid
     * @lazy
     */
    protected $stationsid;


	/**
	 * @return array $stationsid	stationsid
	 */	
	public function getStationsid(){
		if ($this->stationsid instanceof Tx_Extbase_Persistence_LazyLoadingProxy)
{
			$this->stationsid->_loadRealInstance();
		}
		return $this->stationsid;
	}

	/**
	 * @param Tx_RkCamperchecker_Domain_Model_Station $stationsid stationsid
	 * @return void
	 */	
	public function setStationsid(Tx_RkCamperchecker_Domain_Model_Station
$anbieterid){
		$this->stationsid = $stationsid;
	}
}


More information about the TYPO3-project-typo3v4mvc mailing list