| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- // @docs in Schema_TableFactory
- class Schema_TableBase {
- public $idDatabase;
- public $tblName;
- public function __construct($idDatabase, $tblName) {
- $this->idDatabase = $idDatabase;
- $this->tblName = strtolower($tblName);
- $this->_types = array();
- $this->_restrictions = array();
- $this->initTypes();
- }
- public function initTypes() {// TODO: override
- // parent::initTypes();// always call parent method
- // example: $this->_types['WWW'] = 'p5:www_link';
- // example: $this->_restrictions['WWW'] = ['maxLength' => 255]
- // TODO:? $this->_types['WWW'] = new Type_Link($params = ['maxLength' => 255, ...]);
- }
- public function fixTypes($types) {
- if (empty($this->_types)) return $types;
- foreach ($types as $fldName => $type) {
- if (array_key_exists($fldName, $this->_types)) {
- $types[$fldName]['simpleType'] = $this->_types[$fldName];
- }
- if (array_key_exists($fldName, $this->_restrictions)) {
- $types[$fldName]['restrictions'] = $this->_restrictions[$fldName];
- }
- // TODO: add default xsdElementType('simpleType', 'complexType'), xsdType(p5Type:...), ... for every field
- }
- return $types;
- }
- }
|