Exemplo n.º 1
0
 /**
  * Get database field definition
  * @params pdoMap_Mapping_Metadata_Field Field to manage
  * @returns array of pdoMap_Mapping_Metadata_Field                     
  */
 public function getMeta(pdoMap_Mapping_Metadata_Field $field)
 {
     if ($field->type != 'Foreign') {
         throw new pdoMap_Database_Fields_Exceptions_BadType($field, 'Foreign');
     }
     // CHECK ADAPTER
     if (!$field->getOption('adapter')) {
         throw new pdoMap_Database_Fields_Exceptions_ExpectedOption($field, 'adapter');
     }
     // TRY ADAPTER
     pdoMap::config()->mapping($field->getOption('adapter'));
     // RETURN FK
     return array(pdoMap_Mapping_Metadata_Field::duplicate($field, pdoMap_Mapping_Metadata_Field::FIELD_TYPE_FK));
 }
<?php

$category = $_GET["category"];
require_once 'lib/pdomap.php';
pdoMap::config('config.xml');
$addInfo = pdoMap::get('additional_info_master')->SelectBy("CAT_ID", $category);
if ($addInfo->count()) {
    $start = true;
    echo "([";
    foreach ($addInfo as $key => $value) {
        if ($start) {
            $start = false;
        } else {
            echo ",";
        }
        echo "{'INFO_NAME' : '" . $value->INFO_NAME . "' , ";
        echo "'MANDATORY' : '" . $value->MANDATORY . "' , ";
        echo "'ADD_INFO_MASTER_ID' : '" . $value->ADD_INFO_MASTER_ID . "' , ";
        echo "'TYPE' : '" . $value->TYPE . "' , ";
        echo "'COMMENTS' : '" . $value->COMMENTS . "'}";
    }
    echo "])";
} else {
    echo "([])";
}
pdoMap::cache()->closeSession();
Exemplo n.º 3
0
 public function Drop()
 {
     // REMOVE TABLE REFERENCES
     if ($this->adapter) {
         foreach (pdoMap::config()->getMappingKeys() as $m) {
             if ($m != $this->adapter) {
                 pdoMap::structure($m)->TableRequest()->DropFk($this->adapter);
             }
         }
     }
     // RUN TABLE DROPPING
     return pdoMap::database()->Request($this->database, 'DROP TABLE IF EXISTS ' . pdoMap_Database_Request_Adapters_MySQL_Builder::escapeTable($this->name, $this->database));
 }
Exemplo n.º 4
0
 /**
  * Get framework configuration instance
  * @returns pdoMap_Core_Config     
  */
 public static function config($file = null)
 {
     if (!is_null($file)) {
         $time = time() - filemtime($file);
         if (!self::cache()->check('config-' . $file, $time)) {
             $conf = new pdoMap_Parsing_Config_Document($file);
             self::cache()->clear();
             self::cache()->set('config-' . $file, $conf->getObject());
         }
         self::$config = self::cache()->get('config-' . $file);
         if (!self::$config) {
             throw new pdoMap_Exceptions_ConfigurationUndefined();
         }
         // WAKEUP SERVICES
         foreach (self::$config->getMappingKeys() as $key) {
             self::get($key);
             // initialize service
         }
     } elseif (!self::$config) {
         throw new pdoMap_Exceptions_ConfigurationUndefined();
     }
     return self::$config;
 }