Exemplo n.º 1
0
 protected function tearDown()
 {
     TypeContainer::reset();
 }
Exemplo n.º 2
0
 private function parseAndCheckFieldsProcess()
 {
     foreach ($this->configClass['fields'] as $name => $field) {
         if (is_string($field)) {
             $field = array('type' => $field);
         }
         if ($this->configClass['inheritance'] && !isset($field['inherited'])) {
             $field['inherited'] = false;
         }
         $this->configClass['fields'][$name] = $field;
     }
     unset($field);
     foreach ($this->configClass['fields'] as $name => $field) {
         if (!is_array($field)) {
             throw new \RuntimeException(sprintf('The field "%s" of the class "%s" is not a string or array.', $name, $this->class));
         }
         if (!isset($field['type'])) {
             throw new \RuntimeException(sprintf('The field "%s" of the class "%s" does not have type.', $name, $this->class));
         }
         if (!TypeContainer::has($field['type'])) {
             throw new \RuntimeException(sprintf('The type "%s" of the field "%s" of the class "%s" does not exists.', $field['type'], $name, $this->class));
         }
         if (!isset($field['dbName'])) {
             $field['dbName'] = $name;
         } elseif (!is_string($field['dbName'])) {
             throw new \RuntimeException(sprintf('The dbName of the field "%s" of the class "%s" is not an string.', $name, $this->class));
         }
         $this->configClass['fields'][$name] = $field;
     }
     unset($field);
 }
Exemplo n.º 3
0
 protected function tearDown()
 {
     IdGeneratorContainer::reset();
     TypeContainer::reset();
 }
Exemplo n.º 4
0
 public function MongatorTypeToPHP($type, $from, $to)
 {
     return strtr(TypeContainer::get($type)->toPHPInString(), array('%from%' => $from, '%to%' => $to));
 }