[Dbix-class] Re: doing a search

A. Pagaltzis pagaltzis at gmx.de
Sun Jan 21 17:45:05 GMT 2007


* Nilson Santos Figueiredo Junior <acid06 at gmail.com> [2007-01-21 06:35]:
> 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".

I don’t feel the need to append `_ref` to all my variable names
in Perl when I create objects, even though they don’t hold the
object, they hold a reference to it.

> 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.

    LEFT JOIN ON entry.author_id = user.id

Is this right? Is this wrong? No idea. I’ll have to look at the
schema to see whether `entry.author_id` does in fact reference
`user.id`. If it were `entry.author_user`, I’d know immediately.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Dbix-class mailing list