PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1001

PHP 에서도 anotation 드리븐을 구현 할 수 있을거 같내요 ㅎ;
 
http://code.google.com/p/addendum/
 
 
 
잘만 활용 하면, spring framework 장점만 경량화 하여
 
 php 진영에서도 ... framework 도 나오지 않을가 하는

생각을 문득 해봤습니다.

 
 
------------------------------------------------------------------
 
 
 
 
 
/** @Table("people") */
class Person {
   // some code
}
 
 
 
$reflection = new ReflectionAnnotatedClass('Person'); // by class name
$reflection->getAnnotation('Table')->value; // contains string "people"
 
 
 
----------------------------------------------------------------------
 
 
 
class RolesAllowed extends Annotation {}
 
/** @RolesAllowed({'admin', 'web-editor'}) */
class CMS {
 // some code
}
 
$reflection = new ReflectionAnnotatedClass('CMS');
$annotation = $reflection->getAnnotation('RolesAllowed');
$annotation->value; // contains array('admin', 'web-editor'
 
 
 
 
 
-------------------------------------------------------------
 
 
 
/** @Mapping(inheritance = @SingleTableInheritance, columns = {@ColumnMapping('id'), @ColumnMapping('name')}) */
class Person {}
 
$reflection = new ReflectionAnnotatedClass('Person');
$annotation = $reflection->getAnnotation('Mapping');
$annotation->inheritance; // SingleTableInheritance annotation
$annotation->columns; // array of ColumnMapping annotations
$annotation->columns[0]->value; // 'id'

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
10년 전 조회 974
10년 전 조회 940
10년 전 조회 982
10년 전 조회 1,089
10년 전 조회 958
10년 전 조회 933
10년 전 조회 959
10년 전 조회 1,052
10년 전 조회 962
10년 전 조회 919
10년 전 조회 937
10년 전 조회 953
10년 전 조회 890
10년 전 조회 899
10년 전 조회 1,196
10년 전 조회 1,272
10년 전 조회 1,233
10년 전 조회 922
10년 전 조회 939
10년 전 조회 899
10년 전 조회 924
10년 전 조회 1,021
10년 전 조회 969
10년 전 조회 862
10년 전 조회 920
10년 전 조회 1,305
10년 전 조회 1,738
10년 전 조회 1,308
10년 전 조회 1,123
10년 전 조회 1,202
10년 전 조회 952
10년 전 조회 933
10년 전 조회 972
10년 전 조회 932
10년 전 조회 957
10년 전 조회 948
10년 전 조회 1,214
10년 전 조회 1,064
10년 전 조회 1,743
10년 전 조회 1,326
10년 전 조회 1,022
10년 전 조회 1,129
10년 전 조회 1,343
10년 전 조회 1,091
10년 전 조회 1,256
10년 전 조회 1,089
10년 전 조회 1,197
10년 전 조회 1,024
10년 전 조회 1,005
10년 전 조회 1,002
10년 전 조회 1,062
10년 전 조회 1,034
10년 전 조회 1,093
10년 전 조회 1,087
10년 전 조회 1,065
10년 전 조회 1,204
10년 전 조회 1,190
10년 전 조회 989
10년 전 조회 1,295
10년 전 조회 1,635
10년 전 조회 1,089
10년 전 조회 1,334
10년 전 조회 1,303
10년 전 조회 1,157
10년 전 조회 1,114
10년 전 조회 1,065
10년 전 조회 1,182
10년 전 조회 946
10년 전 조회 1,005
10년 전 조회 1,218
10년 전 조회 1,049
10년 전 조회 1,006
10년 전 조회 996
10년 전 조회 984
10년 전 조회 1,001
10년 전 조회 983
10년 전 조회 1,010
10년 전 조회 1,009
10년 전 조회 1,120
10년 전 조회 973
10년 전 조회 969
10년 전 조회 1,050
10년 전 조회 1,771
10년 전 조회 983
10년 전 조회 1,007
10년 전 조회 1,112
10년 전 조회 1,037
10년 전 조회 1,149
10년 전 조회 1,118
10년 전 조회 997
10년 전 조회 1,000
10년 전 조회 1,070
10년 전 조회 1,027
10년 전 조회 967
10년 전 조회 919
10년 전 조회 895
10년 전 조회 931
10년 전 조회 1,327
10년 전 조회 925
10년 전 조회 1,064