Exemplo n.º 1
0
 public function getAvailableOffsets()
 {
     $c_class = get_called_class();
     if (!isset(self::$offset_meta[$c_class])) {
         $res = array();
         $finder = $this->getFinder();
         $db_fields = array_keys(fx::schema($finder->getTable()));
         foreach ($db_fields as $field) {
             $res[$field] = array('type' => self::OFFSET_FIELD);
         }
         foreach ($finder->relations() as $rel_name => $rel) {
             $res[$rel_name] = array('type' => self::OFFSET_RELATION, 'relation' => $rel);
         }
         foreach ($finder->getMultiLangFields() as $f) {
             $res[$f] = array('type' => self::OFFSET_LANG);
         }
         $entity_class = $c_class;
         $reflection = new \ReflectionClass($entity_class);
         $methods = $reflection->getMethods();
         foreach ($methods as $method) {
             if ($method::IS_PUBLIC && preg_match("~^_get(.+)\$~", $method->name, $getter_offset)) {
                 $getter_offset = fx::util()->camelToUnderscore($getter_offset[1]);
                 $res[$getter_offset] = array('type' => self::OFFSET_GETTER, 'method' => $method->name);
             }
         }
         self::$offset_meta[$c_class] = fx::collection($res);
     }
     return self::$offset_meta[$c_class];
 }
Exemplo n.º 2
0
 /**
  * 
  * @param type $type data | meta
  */
 public static function dumperGetTables($type)
 {
     $meta = array('component', 'datatype', 'field', 'lang', 'lang_string', 'layout', 'module', 'option', 'patch', 'patch_migration', 'widget');
     if ($type === 'meta') {
         return $meta;
     }
     $all = array_keys(fx::schema());
     // do not export content table, it needs special treatment
     $meta[] = 'floxim_main_content';
     return array_diff($all, $meta);
 }
Exemplo n.º 3
0
 protected function getColumns($table = null)
 {
     if (!$table) {
         $table = $this->table;
     }
     $schema = fx::schema($table);
     return $schema ? array_keys($schema) : null;
 }