@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if (!array_key_exists($typeattribute, self::$typemap)) { |
| 39 | 39 | throw new \Exception('unknown type ' . $typeattribute); |
| 40 | 40 | } |
| 41 | - $search = array('unsigned ', 'guid', 'datetime', 'text', 'longtext'); |
|
| 41 | + $search = array('unsigned ', 'guid', 'datetime', 'text', 'longtext'); |
|
| 42 | 42 | $replace = array('', 'string', 'midgard_datetime', 'string', 'string'); |
| 43 | 43 | |
| 44 | 44 | return str_replace($search, $replace, $typeattribute); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $mgd_config = midgard_connection::get_instance()->config; |
| 57 | 57 | $mgdschema_file = $mgd_config->vardir . '/mgdschema_classes.php'; |
| 58 | - if ( file_exists($mgdschema_file) |
|
| 58 | + if (file_exists($mgdschema_file) |
|
| 59 | 59 | && !unlink($mgdschema_file)) { |
| 60 | 60 | throw new \RuntimeException('Could not unlink ' . $mgdschema_file); |
| 61 | 61 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $cms = $em->getMetadataFactory()->getAllMetadata(); |
| 73 | 73 | |
| 74 | 74 | // create storage |
| 75 | - if ( !midgard_storage::create_base_storage() |
|
| 75 | + if (!midgard_storage::create_base_storage() |
|
| 76 | 76 | && midgard_connection::get_instance()->get_error_string() != 'MGD_ERR_OK') { |
| 77 | 77 | throw new \Exception("Failed to create base database structures" . midgard_connection::get_instance()->get_error_string()); |
| 78 | 78 | } |
@@ -56,6 +56,9 @@ discard block |
||
| 56 | 56 | return true; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | + /** |
|
| 60 | + * @param string $classname |
|
| 61 | + */ |
|
| 59 | 62 | public static function create_class_storage($classname) |
| 60 | 63 | { |
| 61 | 64 | $em = connection::get_em(); |
@@ -87,6 +90,11 @@ discard block |
||
| 87 | 90 | $generator->generateProxyClass($cm, $filename); |
| 88 | 91 | } |
| 89 | 92 | |
| 93 | + /** |
|
| 94 | + * @param Doctrine\ORM\EntityManager $em |
|
| 95 | + * |
|
| 96 | + * @return ClassMetadata |
|
| 97 | + */ |
|
| 90 | 98 | private static function get_cm($em, $classname) |
| 91 | 99 | { |
| 92 | 100 | if (!class_exists($classname)) { |