/**
  * Returns the list of checks
  *
  * @return array name => description
  */
 public function getChecks()
 {
     $out = array();
     foreach ($this->checks->getForeignKeys() as $key => $value) {
         $out['FK_' . $key] = $value;
     }
     foreach ($this->checks->getQueries() as $key => $value) {
         $out['Other_' . $key] = $value;
     }
     return $out;
 }
Esempio n. 2
0
 public function writeFile($filename, ezdbiSchemaChecks $schemaDef)
 {
     $out = "<?php /*\n";
     $out .= "\n[ForeignKeys]\n";
     foreach ($schemaDef->getForeignKeys() as $def) {
         $defs = array($def['childCol'], $def['parentTable'], $def['parentCol']);
         if ($def['exceptions'] != '') {
             $defs[] = $def['exceptions'];
         }
         $out .= $def['childTable'] . '[]=' . implode($this->token, $defs) . "\n";
     }
     $out .= "\n[CustomQueries]\n";
     foreach ($schemaDef->getQueries() as $def) {
         $name = str_replace(' ', '_', $def['description']);
         $out .= $name . '[sql]=' . str_replace("\n", ' ', $def['sql']) . "\n";
         if ($def['longDesc'] != '') {
             $out .= $name . '[description]=' . str_replace("\n", ' ', $def['longDesc']) . "\n";
         }
     }
     file_put_contents($filename, $out);
 }