[TYPO3-mvc] extbase: relations simple question

Christine Gerpheide cgerpheide at gmail.com
Mon Feb 15 20:07:06 CET 2010


I would say (a) is better, $client->getProjects().  It feels much more
natural, even semantically.  Also, unless you want to be able to view
projects regardless of Client, you may not even need a projectRepository at
all.

That's my opinion, anyway,
Christine

2010/2/15 Thomas "Thasmo" Deinhamer <thasmo at gmail.com>

> You can of course use both ways, if you like:
>
> $projects = $client->getProjects();
> $client = $project->getClient();
>
> Greatings,
> Thomas
>
> Am 15.02.2010 19:49, schrieb Dmitri Pusarev:
>
>  OK, I think I can make my question more specific:
>> a) $projects = $client->getProjects();
>> b) $this->projectRepository->findByClient($client);
>> Which is better to get all projects for given client, a) or b)?
>>
>>
>> Dmitri Pusarev wrote:
>>
>>> Hey!
>>> In my model I have a Client and a Project. Relations which pop into my
>>> mind from the business domain:
>>> a)Client has a relation projects with Project, 0..*(fk).
>>> b)Project has a relation client with Client, 0..1.
>>> Should I create both a) and b)? Or just a) is enough?
>>>
>>> In the database language(which I more used to), I would just create a
>>> field 'client' in the table 'Projects'.
>>>
>>> Sorry, I'm still learning!
>>>
>>> Cheers,
>>> Dmitri.
>>>
>> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list