Re: Following links in QB
Eero af Heurlin <eero.afheurlin-ZpG/[email protected]>
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Torben Nehmer wrote:
>>> * $qb = new MidgardQueryBuilder("midgard_article");
>>> * $subqb = $qb->forward_join("author");
>>> * $subqb->add_constraint("username", "=", "foo");
>>> * $qb->execute(); // Returns all articles authored by "foo"
>
>
> Why not sticking to the dot-syntax?
>
> $qb->add_constraint("author.username", "=", "foo"); looks much easier to me and
> is equally readable.
>
The dot syntax for simple forward joins should naturally be available as
a shorthand, but if we follow another level of link then it gets hairier.
It's also consistency, backward join practically needs the subqb and a
method to instance it, so it's good to have the forward join method as well.
/Rambo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDulHtk2FlZlXdE74RAwmsAJ4mOaswzou20SgaJ77oFxcZKc61xACeLESo
4fCZAGQPBp9VF4rzQL9p0gE=
=VzzK
-----END PGP SIGNATURE-----