Re: Following links in QB
Torben Nehmer <[email protected]>
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
- --Jukka Zitting wrote on 2005-12-30 14:11:
> Currently the query builder only has limited supports for link
> properties, namely the dot syntax in add_constraint(). I'd like to
> propose the following new methods as an advanced version of the join()
> method proposed earlier by Piotras.
> [...]
> * $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 main problem I see here is integration with the current ACL implementation,
which is not possible unless we start moving ACL to the core.
Reason:
The Subquery must be ACL-checked as well as the main Query. Not in all cases the
objects returned by the main query will be childs in terms of object hierarchy
of the subqueries object (in which case ACL would implicitly work correctly).
Especally with memberships and similar relationships, this must be taken into
account at every level of the query, IMHO at least; otherwise we'd loose the ACL
semantics in part.
The problem of course is that this is potentially a big performance hog.
So we need to have an official point of view wether we a) want to enforce ACLs
100% or b) have a few well-defined exceptions for performance reasons.
In this special case I'd actually opt for b), but *if* we start making
exceptions we should very precicly think about where we do them and why we do
them (being complex isn't an excuse in my eyes). So mostly a matter of
documentation I think.
Live long and Prosper!
Torben Nehmer
- --
Torben Nehmer, Guenzburg, Bavaria, Germany
http://www.nathan-syntronics.de, mailto:[email protected]
PGP Public Key: https://www.link-m.de/pgp/t.nehmer.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDujq0JPh4Kn6d5FYRAoy8AKCUI3+sPlBhv7Wf9BEEvrpPMAcRfwCg5nne
rztoPGfgL7V4N3dvUOk3zI4=
=Vub6
-----END PGP SIGNATURE-----