[TYPO3-mvc] Child object values

Sebastian Schreiber me at schreibersebastian.de
Mon Feb 13 12:56:18 CET 2012


i you have your mark object in your controller, just call 
$mark->getModuleDetail()->getCode();




Am 13.02.2012 12:54, schrieb Matt Janus:
> Just realised attachment won't work, so here are some excerpts from the model
>
> class Tx_Modulemarks_Domain_Model_Mark extends
> Tx_Extbase_DomainObject_AbstractEntity {
>
> 	/**
> 	 * Overall Grade
> 	 *
> 	 * @var string
> 	 */
> 	protected $overallGrade;
> 	
> 	/**
> 	 * Overall Mark
> 	 *
> 	 * @var string
> 	 */
> 	protected $overallMark;	
> 	
> 	/**
> 	 * Module Details
> 	 *
> 	 * @var Tx_Modulemarks_Domain_Model_Module
> 	 * @lazy
> 	 */
> 	protected $moduleDetail;
> 	
> 	/**
> 	 * Returns the overallGrade
> 	 *
> 	 * @return string $overallGrade
> 	 */
> 	public function getOverallGrade() {
> 		return $this->overallGrade;
> 	}
> 	
> 	/**
> 	 * Returns the overallMark
> 	 *
> 	 * @return string $overallMark
> 	 */
> 	public function getOverallMark() {
> 		return $this->overallMark;
> 	}
> 	
> 	/**
> 	 * Returns the moduleDetail
> 	 *
> 	 * @return Tx_Modulemarks_Domain_Model_Module $moduleDetail
> 	 */
> 	public function getModuleDetail() {
> 		return $this->moduleDetail;
> 	}
>
> }
>
> class Tx_Modulemarks_Domain_Model_Module extends
> Tx_Extbase_DomainObject_AbstractValueObject {
> 	
> 	/**
> 	 * Module Code
> 	 *
> 	 * @var string
> 	 */
> 	protected $code;
> 	
> 	/**
> 	 * Returns the code
> 	 *
> 	 * @return string $code
> 	 */
> 	public function getCode() {
> 		return $this->code;
> 	}
> 	
> 	....
>
> }
>
> I hope this helps.
>
> Thanks
>
> Matt
>
> On Mon, Feb 13, 2012 at 11:49 AM, Matt Janus<janus76uk at googlemail.com>  wrote:
>> I am just starting out with extbase and slowly getting my head around
>> it but I am having  a problem of access values of child object.
>>
>> each mark will contain an over all mark, number of question answered
>> etc. it will then reference a value object that will contain
>> information regarding the module such as module title, module code and
>> the number of exam questions for that module.
>>
>> I have attached the an image to help explain (hopefully it will show up).
>>
>> In the fluid template I can access the values of the module by -
>> {mark.moduledetail.code}
>>
>> The question I have, is how can I access this value in the mark
>> controller? I'm sure its something very simple but it has been driving
>> me mad for days.
>>
>> Any help, or pointers would be most appreciated.
>>
>> Thanks
>>
>> Matt
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


-- 
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)

Schanzenstraße 27, Schlosserei 4
D-51063 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 217 / 5269 / 4675



More information about the TYPO3-project-typo3v4mvc mailing list