Date index for Jul 2003


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [achievo] Loading a node from the database



Sebastian Paul Avarvarei wrote:

Hello Everyone,

I'm trying to develop some extensions modules to Achievo (to which I'm very
new) and I was hoping someone could help me with a problem I'm having.

In one of my classes I have an attribute atkManyToOneRelation referencing
"organization.organization" - so this attribute holds the id of an
organization. And I want in the preUpdate() method of my class to do some
processing based on some attributes of the referenced organization.

My question is: what is the correct method, using the Achievo API, for
"loading" that specific organization from the database, so I can see its
details (e.g. name, address etc.)?


Enable debuggin by setting config_debug to 1 (in your config.inc.php)

You could use $rs = $node->selectDB();
This function returns a recordset. You could also give parameters to selectDB, the first parameter is the condition (without the "where" part), eg $node->selectDB("id=10");


To see the data which is in the recordset you could try:
atk_var_dump($rs);

The recordset which this function returns is a multidimensional array

The record in preUpdate might already contain the data you need. This records holds also information about relations. Try the following preUpdate function (inside your node):

function preUpdate(&$record)
{
   atkdebug("vardumping preupdate record!");
   atk_var_dump($record);
}


Best Regards, Kees


Any help is appreciated.

Best regards,
Sebastian


[ Achievo mailing list -
http://www.achievo.org/ ] [ to unsubscribe send an e-mail to achievo-unsubscribe dot 





http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV