Re: midgard_guid_new and legacy objects

Piotras <pp-VVDi8QVAvoBWk0Htik3J/[email protected]> Wed, 8 Mar 2006 11:20:55 +0100
Newsgroups gmane.comp.web.midgard.devel
Message-ID <[email protected]>
"Jukka Zitting" <[email protected]> wrote:

> Hi,

Hi,
 
> > Since 1.8 spider admin and Aegir's usage should be forbidden
> > as those uis creates objects without guids.
> 
> What do you mean: "creates objects without guids"? It shouldn't be the
> applications task to create the GUID, it should be generated
> automatically for each new object by midgard-core.

Spider, Aegir:

$person = mgd_get_person(); /* MidgardPerson */
/* some code */
$person->create();

midgard-core ( when auth is called ) 

MgdObject *object = midgard_object_new_by_id(
	mgd,  "midgard_person",  (gchar *) mgd->current_user->id);

> The full object should always have the GUID, regardles of what creates
> it or how it has been retrieved. A "guidless" object is always an
> error.

const gchar *guid;
g_object_get(G_OBJECT(object), "guid", &guid, NULL);

/* It deson't make sense to check. Throw error!  */
if(midgard_is_guid(guid))
	g_error("Person object has no guid value");


Legacy objects has guid accessible after guid method was called and guid value is stored in repligard 
table, while new objects has guid stored in object's table to avoid multitable selects.

PIotras