<?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.º 2
0
 /**
  * Truncate table
  */
 public function Truncate()
 {
     $this->TableRequest()->Truncate();
     pdoMap::cache()->clear();
 }
Exemplo n.º 3
0
 /**
  * Reload state from database
  */
 public function Refresh()
 {
     pdoMap::cache()->removeEntity($this);
     return pdoMap::get($this->type)->SelectEntity($this->getPk());
 }
Exemplo n.º 4
0
 /**
  * Insert an entity
  * @returns mixed Returns inserted ID if ok, or false         
  * @throw pdoMap_Mapping_Exceptions_EntityValidate         
  */
 public function Insert(pdoMap_Mapping_Entity &$entity)
 {
     // VALIDATE ENTITY
     if (!$this->Validate($entity)) {
         throw new pdoMap_Mapping_Exceptions_EntityValidate($entity);
     }
     // START INSERT EVENT
     $event = $this->raise('Insert', new pdoMap_Mapping_Adapter_Args($entity));
     if ($event) {
         $request = $this->getRequest()->Insert();
         foreach ($this->getStructure()->getFields() as $field) {
             pdoMap::field()->PrepareRequestSetter($event->entity, $field, $request);
         }
         $id = $request->Run();
         if ($id) {
             $event->entity->setValue($this->getStructure()->getPk()->bind, $id);
             $event->entity->isDbLink = true;
             $event->entity->Commit();
             pdoMap::cache()->setEntity($event->entity);
             return $id;
             // RETURNS INSERTED ID
         } else {
             throw new pdoMap_Mapping_Exceptions_TransactionError('insert', $entity);
         }
     } else {
         return false;
     }
     // EVENT WAS CANCEL
 }
Exemplo n.º 5
0
 /**
  * Get an adapter instance (singleton version)
  * Use static call directly for php 5.3 versions
  * @params string Binded table name           
  * @returns pdoMap_Mapping_IAdapter 
  */
 public static function get($type)
 {
     if (!isset(self::$services[$type])) {
         self::using($type);
         if (!pdoMap::cache()->hasService($type)) {
             $interface = self::structure($type)->service;
             $classes = get_declared_classes();
             foreach ($classes as $namespace) {
                 $reflexion = new ReflectionClass($namespace);
                 if (!$reflexion->isAbstract() && !$reflexion->isInterface() && $reflexion->implementsInterface($interface)) {
                     if (!pdoMap::cache()->hasService($type)) {
                         pdoMap::cache()->setService($type, $reflexion->newInstance());
                     } else {
                         throw new pdoMap_Exceptions_ServiceDuplicated($type, $interface, pdoMap::cache()->getService($type), $namespace);
                     }
                 }
             }
         }
         self::$services[$type] = pdoMap::cache()->getService($type);
         if (!self::$services[$type]) {
             throw new pdoMap_Exceptions_ServiceNotFound($type);
         }
     }
     return self::$services[$type];
 }