[TYPO3-mvc] FLUID :: how can you access properties of m:n related objects?
Sebastian Schreiber
me at schreibersebastian.de
Thu Nov 3 15:52:16 CET 2011
Am 03.11.2011 15:16, schrieb Roland:
>> For the getter approach you can write something like that:
>>
>> public function getFirstZulassung() {
>> $object = $this->getZulassungen() // Or whatever
>> // Maybe you can drop the instanceof validation
>> if($object instanceof Tx_Extbase_Persistence_ObjectStorage) {
>> $object->rewind();
>> if($object->valid()) {
>> return $object->current();
>> }
>> }
>> }
>
> hi sebastian,
>
> ==========
>
> QUESTION 1: how must the comment for this getter method look like? as
> far as i know it can be essential how exactly it looks.
>
> --- quote ---
>
> /**
> * Gets the first related zulassung (main zulassung)
> *
> * @return XYZ
> */
>
> --- /quote ---
>
> what about the @return?
>
> ==========
>
> QUESTION 2: why did you mention "Maybe you can drop the instanceof
> validation"? what is the point here?
>
> ==========
>
> kind regards.
>
> roland
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
Question 1:
Well, you are returning an Object Zulassung in your case, don´t you.
So @return Tx_ExtKey_Domain_Model_Zulassung
Question 2:
I add this type of validation just to be sure that we have an instance
of Tx_Extbase_Persistence_ObjectStorage otherwise we will run into some
fatal errors
if we have something different. But i thought that in your case the
validation is obsolete, because we already know that it is an
Tx_Extbase_Persistence_ObjectStorage.
Sorry for mention that:
I have seen a lot of people learning essential PHP things through
working with a MVC-framework (in my case symfony).
That´s not a good starting point. I would recommend to learn first some
essential things like OOP in PHP and some other things.
Otherwise you will never ever feel comfortable with the framework of choice.
Maybe i´m wrong in your case, but start to learn the basics along with
books and more. It helps a lot to get into the flow.
You are welcome
--
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