/** * Load one related object. * * @param string $relationName name of the desired relation * @param GenericCriterionObject $criterion criterion object * * @return GenericORMapperDataObject object that is related with the current object or null. * @throws GenericORMapperException In case the data component is not initialized. * * @author Tobias Lückel * @version * Version 0.1, 09.09.2010<br /> */ public function loadRelatedObject($relationName, GenericCriterionObject $criterion = null) { // check weather data component is there if ($this->dataComponent === null) { throw new GenericORMapperException('[GenericDomainObject::loadRelatedObject()] ' . 'The data component is not initialized, so related object cannot be loaded! ' . 'Please use the or mapper\'s loadRelatedObject() method or call ' . 'setDataComponent($orm), where $orm is an instance of the or mapper, on this ' . 'object first!', E_USER_ERROR); } // return objects that are related to the current object return $this->dataComponent->loadRelatedObject($this, $relationName, $criterion); }