[Dbix-class] Re: doing a search

Nilson Santos Figueiredo Junior acid06 at gmail.com
Sun Jan 21 05:28:32 GMT 2007


On 1/20/07, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> Ugh, yeah, not my intent at all. This scheme is in fact carefully
> chosen to avoid redundant information. F.ex. most people name
> their FK columns something like `${othertable}_id` – but the only
> purpose the `_id` bit serves is to call out the column as an FK.
> It doesn't have any descriptory value of its own. That's not so
> bad as long as you don't have multiple FKs to the same table in
> one table, but if you need to, those `_id` bits become really
> obvious clutter.

I don't really agree with that. I think the "id" suffix in e.g.
"user_id" describes exactly the data that field contains: an user id.
It doesn't really contain the actual user object - which can be
fetched through the relationship "user".

Note that it doesn't mean that "user" (i.e. the prefix) should always
be the name of the referenced table. In that posts example you could
use a field called "author_id" which would reference an user. No
problem with that since your intent would be clear when describing the
relationship.

-Nilson Santos F. Jr.



More information about the Dbix-class mailing list