new queries

0 views
Skip to first unread message

ctrapp...@gmail.com

unread,
Apr 18, 2007, 6:23:03 PM4/18/07
to Php Object Generator
Hi,

I created a pog object For a users table. I want to add a query to it
that checks if a user exists (via his username not userid). I will
add this function and query myself. However, what if requirements
change and I have to add a field? Does this mean I need to re-add my
function or is there some better way?

Joel

unread,
Apr 18, 2007, 6:32:43 PM4/18/07
to Php Object Generator
You basically have 2 options.

you can extend your users object and put the query there. Thus, when
you regenerate the base object, it won't affect your custom function.

moreover, as from 3.0 you'll be able to write a plugin to allow this
sort of customization, but on a project level... i.e. you can create a
plugin which will check if an object exist based on an arbitrary field
instead of object id.

option 1 seems to be the best solution for you. #2 is to make custom
function even more generic and re-usable.

regards,
joel

On Apr 18, 4:23 pm, "ctrappber...@gmail.com" <ctrappber...@gmail.com>
wrote:

Paris Paraskeva

unread,
Apr 19, 2007, 11:36:13 AM4/19/07
to Php-Object...@googlegroups.com
Create a separate function in a file and store it in your includes folder so
you don't need to add this in your object every time you change it. I
suspect that the pog plug-ins will be in similar manner but they will extend
and object and will be available thought an object method.

// example code. Not tested
function check_user_exist($username) {
$user= new user();
$user = $user->GetList(array(array("username", "=", $username));
If count($user>0) {
return true;
}
else
return false;
}
}

Regards,

Paris Paraskeva
Managing Director
M.E. & E. United Worx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.


Hi,


__________ NOD32 2202 (20070418) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


Reply all
Reply to author
Forward
0 new messages