| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- // @docs in Schema_TableFactory
- class Schema_TableBase {
- public function __construct() {
- $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 (!is_array($this->_types)) return;
- 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];
- }
- }
- return $types;
- }
- }
|