Re: tablename/guid vs. classname/guid
Torben Nehmer <[email protected]>
| Newsgroups | gmane.comp.web.midgard.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, - --Piotras wrote on 2006-02-07 17:30: >> > Class name means type name defined in schema. >> >> Can you give me your reasoning for the class/type-name strategy please? > > Sure. > > $object = mgd_get_object_by_guid($guid); > > 1. Scenario with tablename&id > > SELECT realm , id from repligard where guid=$guid; > Returned value is topic,3. Now we have X types which uses table topic. > What should be selected from topic table? > > 2. Scenario with typename&id > > SELECT typename , id from repligard where guid=$guid; > Returned value is my_db_superclass,3. > new instance of my_db_superclass is created and got by id 3. > > Real example could use midgard_group and org_openpsa_organization. > Both types use grp table. But use different columns. > > Of course get_by_guid method shouldn't make any repligard table lookups. Ok, very well. What do you do when you move the id column of a table to a guid? Wouldn't it be better to always return a "base type" (using scenario 1) and let the application decide what it does. I see the benifits of both implementation, but I fear the side-effects of the possibility that a single db object has multiple guids across the types. 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 iD8DBQFD6MzkJPh4Kn6d5FYRAt8oAJwIpnbegB5kAydoGa4FotEEjP+mUQCgy6w9 m8204q00FAYaj3enuhw49+A= =wddJ -----END PGP SIGNATURE-----