Questions on extending DataObject
| From: | Markus Wolff | Date: | Wed, 02 Jul 2003 22:18:12 +0000 |
| Subject: | Questions on extending DataObject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6411@lists.php.net to get a copy of this message | ||
Hi there,
whoah, this package is really great - I´ve decided to kick out our own implementations and use DataObject exclusively from now on ;-)
As I like to be able to habe running prototypes for applications rather quickly, I´ve begun to write a class that extends DB_DataObject and contains additional utility methods, the first being a method called getForm() that tries to automatically build a HTML_QuickForm object from the DataObject´s properties.
In the process of doing that, I´ve run into some trouble though:
If the DataObject has links to other tables, I want to add a
selectbox to the form that contains all possible entries of the linked
table to choose from (I know this is risky, I´m gonna make this configurable later on).
To find out if there are any links, I wanted to use the getLinks() method like this:
if ($this->getLinks()==true) {
// Do something with that information} Unfortunately, getLinks() always returns false and never fetches the linked data. To find out if it´s just the link.ini that has wrong definitions, I then tried it with $this->getLink('linked_field_id') and it worked like a charm, so I assume my link.ini must be correct. Is there another method that allows to just check if a specific field actually *is supposed* to have links, without trying to retrieve them? That would be perfect for my needs. If there´s not, how would I need to proceed to write such a thing? Are the link informations stored in some config variables somewhere? Another problem: I have added these config settings to my DataObject.ini ... extends_location = DB/DataObjectOnSpeed.php extends = DB_DataObjectOnSpeed When the classes are generated, the "extends" section is correctly rewritten to "DB_DataObjectOnSpeed". The require_once() statement, however, remains untouched and still points to "DB/DataObject.php", so I have to do an additional search & replace after the class generation. Thanks in advance for any insight on these topics. Regards, Markus