@@ -41,6 +41,9 @@ discard block |
||
| 41 | 41 | return self::$cache->fetch($key); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param string $classname |
|
| 46 | + */ |
|
| 44 | 47 | private static function addControllerCache($classname){ |
| 45 | 48 | $parser=new ControllerParser(); |
| 46 | 49 | try { |
@@ -65,11 +68,17 @@ discard block |
||
| 65 | 68 | return ["annotations"=>$annotationCacheDir,"models"=>$modelsCacheDir,"controllers"=>$controllersCacheDir]; |
| 66 | 69 | } |
| 67 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $dir |
|
| 73 | + */ |
|
| 68 | 74 | private static function safeMkdir($dir){ |
| 69 | 75 | if(!is_dir($dir)) |
| 70 | 76 | return mkdir($dir,0777,true); |
| 71 | 77 | } |
| 72 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $folder |
|
| 81 | + */ |
|
| 73 | 82 | private static function deleteAllFilesFromFolder($folder){ |
| 74 | 83 | $files = glob($folder.'/*'); |
| 75 | 84 | foreach($files as $file){ |
@@ -81,6 +81,9 @@ |
||
| 81 | 81 | return $result; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $path |
|
| 86 | + */ |
|
| 84 | 87 | private function createRouteMethod(&$result,$path,$httpMethods,$method,$routeAnnotation,$parameters){ |
| 85 | 88 | foreach ($httpMethods as $httpMethod){ |
| 86 | 89 | $result[$path][$httpMethod]=["controller"=>$this->controllerClass,"action"=>$method,"parameters"=>$parameters]; |
@@ -64,6 +64,9 @@ discard block |
||
| 64 | 64 | return $ret; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | + /** |
|
| 68 | + * @param string $annotation |
|
| 69 | + */ |
|
| 67 | 70 | public static function getAnnotationClass($class,$annotation){ |
| 68 | 71 | $annot=Annotations::ofClass($class,$annotation); |
| 69 | 72 | return $annot; |
@@ -76,6 +79,10 @@ discard block |
||
| 76 | 79 | return false; |
| 77 | 80 | } |
| 78 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $method |
|
| 84 | + * @param string $annotation |
|
| 85 | + */ |
|
| 79 | 86 | public static function getAnnotationsMethod($class,$method,$annotation){ |
| 80 | 87 | $annots=Annotations::ofMethod($class,$method,$annotation); |
| 81 | 88 | if(\sizeof($annots)>0) |
@@ -83,6 +90,9 @@ discard block |
||
| 83 | 90 | return false; |
| 84 | 91 | } |
| 85 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $annotation |
|
| 95 | + */ |
|
| 86 | 96 | public static function getMembersAnnotationWithAnnotation($class,$annotation){ |
| 87 | 97 | $props=self::getProperties($class); |
| 88 | 98 | $ret=array(); |
@@ -105,6 +115,9 @@ discard block |
||
| 105 | 115 | return $ret; |
| 106 | 116 | } |
| 107 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $annotation |
|
| 120 | + */ |
|
| 108 | 121 | public static function getMembersNameWithAnnotation($class,$annotation){ |
| 109 | 122 | $props=self::getProperties($class); |
| 110 | 123 | $ret=array(); |
@@ -116,6 +129,9 @@ discard block |
||
| 116 | 129 | return $ret; |
| 117 | 130 | } |
| 118 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $member |
|
| 134 | + */ |
|
| 119 | 135 | public static function isNullable($class,$member){ |
| 120 | 136 | $ret=self::getAnnotationMember($class,$member,"@column"); |
| 121 | 137 | if (!$ret) |
@@ -124,6 +140,9 @@ discard block |
||
| 124 | 140 | return $ret->nullable; |
| 125 | 141 | } |
| 126 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $member |
|
| 145 | + */ |
|
| 127 | 146 | public static function isSerializable($class,$member){ |
| 128 | 147 | if (self::getAnnotationMember($class,$member,"@transient")!==false || self::getAnnotationMember($class,$member,"@manyToOne")!==false || |
| 129 | 148 | self::getAnnotationMember($class,$member,"@manyToMany")!==false || self::getAnnotationMember($class,$member,"@oneToMany")!==false) |
@@ -132,6 +151,9 @@ discard block |
||
| 132 | 151 | return true; |
| 133 | 152 | } |
| 134 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $member |
|
| 156 | + */ |
|
| 135 | 157 | public static function getFieldName($class,$member){ |
| 136 | 158 | $ret=self::getAnnotationMember($class, $member, "@column"); |
| 137 | 159 | if($ret===false) |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace micro\orm\parser; |
| 3 | 3 | |
| 4 | -use mindplay\annotations\Annotation; |
|
| 5 | 4 | use mindplay\annotations\Annotations; |
| 6 | 5 | use micro\orm\OrmUtils; |
| 7 | 6 | |