コード例 #1
0
ファイル: Migration.php プロジェクト: phuongjolly/ECard
 /**
  * Get Class Properties
  * @param $item
  * @return array
  */
 public static function getProperties($item)
 {
     // create a reflector
     $reflector = new \ReflectionClass($item);
     $columns = array();
     // iterate all $property
     foreach ($reflector->getProperties() as $property) {
         $document = $property->getDocComment();
         $matches = null;
         // find annotation
         if (preg_match("/@column\\((?P<type>[^)]+)\\)/", $document, $matches)) {
             $type = $matches["type"];
             $column = new Column();
             $column->setType($type);
             $column->name = $property->name;
             $columns[] = $column;
         }
     }
     return $columns;
 }