Framework Development
| From: | Simon Biela | Date: | Fri, 14 Jun 2002 10:06:00 +0000 |
| Subject: | Framework Development | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7012@lists.php.net to get a copy of this message | ||
Dear PEAR-Developers!
We are just starting to develop a framework for eBusiness projects, which might be interesting for
you. It's kind of difficult to explain in my poor english, but I think the attached
code-examples (not working) should give you an idea of what we want to do. If you can't use it
in PEAR, I anyways would love to get a feedback from you.
Basically we are building a base class "KBDBObject" which gives developers the power of
building object-oriented objects which are managed in a database. No need to worry about any SQL
Calls or cookie-handling. The base-class will use ADODB to send the constructed SQL92-conform
queries to the database.
Building a new object for usermanagement in your project will be as easy as:
class KBUser extends KBDBObject
{
function KBUser($_db)
{
$this->db = $_db;
$this->table = 'users';
$this->keycolumn = 'id';
$this->allowedfields = array();
array_push($this->allowedfields, 'id');
array_push($this->allowedfields, 'username');
array_push($this->allowedfields, 'password');
}
}
You could then work with the user:
// reading userdata and saving the object for using on other pages
$myUser = new KBUser();
$myUser->save_in_cookie();
$name = $myUser ->getField(name);
You could display userdata in a form i.e. with a template toolkit.
Maybe you want to write userdata coming from a form in the database.
// updating userdata
$myUser->setField(name,"Jon Doe");
$myUser->write_to_database();
The "KBDBObject"-Class will worry about the rest. The attached example is not working at
all and only meant for flat tables at the moment. Dependencies to other tables (relation-tables,
foreign-keys) will also be supported. So it would be possible to extend a user-object with rights
(n-m relation) or groups (could be 1-m relation)
Once finished, we want to build different toolkits for typical eBusiness Applications with this
toolkit and link to existing other toolkits:
user management
shopping cart
order management
product management
base-data management
export and import (i.e. XML)
to name some of our ideas.
I hope this idea isn't completely stupid.
best regards
Simon Biela
management
---
kernpunkt GmbH
cross communication
Krefelder Strasse 18
50670 Koeln
tel: +49 221 - 569 576 10
fax: +49 221 - 569 576 29
infoline: 0800 KERNPUNKT
s.biela@kernpunkt.de
http://www.kernpunkt.de