svn: /pear/packages/DB_DataObject/trunk/DataObject/ Generator.php
| From: | Alan Knowles | Date: | Fri, 05 Mar 2010 23:55:59 +0000 |
| Subject: | svn: /pear/packages/DB_DataObject/trunk/DataObject/ Generator.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-59008@lists.php.net to get a copy of this message | ||
alan_k Fri, 05 Mar 2010 23:55:59 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295872
Log:
add hookpostvar for adding things like varchar len data etc.. as per req #13798
Bug: http://pear.php.net/bugs/13798 (unknown)
Changed paths:
U pear/packages/DB_DataObject/trunk/DataObject/Generator.php
Modified: pear/packages/DB_DataObject/trunk/DataObject/Generator.php
===================================================================
--- pear/packages/DB_DataObject/trunk/DataObject/Generator.php 2010-03-05 23:52:52 UTC (rev 295871)
+++ pear/packages/DB_DataObject/trunk/DataObject/Generator.php 2010-03-05 23:55:59 UTC (rev 295872)
@@ -939,6 +939,7 @@
// show nice information!
$connections = array();
$sets = array();
+
foreach($defs as $t) {
if (!strlen(trim($t->name))) {
continue;
@@ -967,6 +968,8 @@
// $sets[$t->Field] = "array".substr($t->Type,3);
$body .= $this->derivedHookVar($t,$padding);
}
+
+ $body .= $this->derivedHookPostVar($defs,$padding);
// THIS IS TOTALLY BORKED old FC creation
// IT WILL BE REMOVED!!!!! in DataObjects 1.6
@@ -1117,8 +1120,23 @@
// It MUST NOT be changed here!!!
return "";
}
-
/**
+ * hook for after var lines (
+ * called at the end of the output of var line have generated, override to add extra var
+ * lines
+ *
+ * @param array cols containing array of objects with type,len,flags etc. from tableInfo call
+ * @param int padding number of spaces
+ * @access public
+ * @return string added to class eg. functions.
+ */
+ function derivedHookPostVar(&$t,$padding)
+ {
+ // This is so derived generator classes can generate variabels
+ // It MUST NOT be changed here!!!
+ return "";
+ }
+ /**
* hook to add extra page-level (in terms of phpDocumentor) DocBlock
*
* called once for each class, use it add extra page-level docs