| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /* TODO: ACL::getChildRefFullList($namespace); returns array with:
- // [0] => Array:
- // [namespace] => default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy // TODO: childName
- // [A_STATUS] => NORMAL
- // [ID] => 27
- // [SOURCE] => backRef
- */
- class Type_RefConfig {
- var $_data = [];
- static function build($refConfig = []) {
- if (!$refConfig) throw new Exception("Missing data in build Type RefConfig");
- // if (!$refConfig['ID']) throw new Exception("Missing ID in Type RefConfig build"); // TODO: allow missing ID?
- $instance = new Type_RefConfig();
- if (!empty($refConfig['ID'])) $instance->id = (int)$refConfig['ID'];
- if (!empty($refConfig['ROOT_OBJECT_NS'])) $instance->objectNamespace = $refConfig['ROOT_OBJECT_NS']; // namespace
- if (!empty($refConfig['CHILD_NAME'])) $instance->childName = $refConfig['CHILD_NAME']; // typeName
- if (!empty($refConfig['CHILD_NS'])) $instance->childNamespace = $refConfig['CHILD_NS']; // namespace
- $instance->source = $refConfig['SOURCE'];
- $instance->status = $refConfig['A_STATUS'];
- $instance->version = $refConfig['VERSION'];
- return $instance;
- }
- function __isset($name) {
- return (array_key_exists($name, $this->_data));
- }
- function __get($name) {
- if (array_key_exists($name, $this->_data)) {
- return $this->_data[$name];
- }
- return null;
- }
- function __set($name, $value) {
- $this->_data[$name] = $value;
- }
- function toArray() {
- return $this->_data;
- }
- function __toString() {
- return str_replace('"', '',
- str_replace([ '{', '}', '":', ',"' ], [ '{ ', ' }', ': ', ', ' ], json_encode($this->_data))
- );
- }
- }
|