PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1026

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년 전 조회 1,009
10년 전 조회 962
10년 전 조회 1,011
10년 전 조회 1,117
10년 전 조회 988
10년 전 조회 960
10년 전 조회 980
10년 전 조회 1,074
10년 전 조회 981
10년 전 조회 942
10년 전 조회 961
10년 전 조회 983
10년 전 조회 916
10년 전 조회 922
10년 전 조회 1,215
10년 전 조회 1,305
10년 전 조회 1,259
10년 전 조회 952
10년 전 조회 966
10년 전 조회 931
10년 전 조회 946
10년 전 조회 1,046
10년 전 조회 1,000
10년 전 조회 889
10년 전 조회 949
10년 전 조회 1,333
10년 전 조회 1,761
10년 전 조회 1,348
10년 전 조회 1,151
10년 전 조회 1,223
10년 전 조회 979
10년 전 조회 961
10년 전 조회 1,001
10년 전 조회 952
10년 전 조회 992
10년 전 조회 980
10년 전 조회 1,225
10년 전 조회 1,094
10년 전 조회 1,774
10년 전 조회 1,351
10년 전 조회 1,052
10년 전 조회 1,157
10년 전 조회 1,383
10년 전 조회 1,110
10년 전 조회 1,284
10년 전 조회 1,125
10년 전 조회 1,230
10년 전 조회 1,051
10년 전 조회 1,041
10년 전 조회 1,027
10년 전 조회 1,083
10년 전 조회 1,058
10년 전 조회 1,121
10년 전 조회 1,113
10년 전 조회 1,092
10년 전 조회 1,233
10년 전 조회 1,214
10년 전 조회 1,010
10년 전 조회 1,318
10년 전 조회 1,664
10년 전 조회 1,117
10년 전 조회 1,371
10년 전 조회 1,322
10년 전 조회 1,182
10년 전 조회 1,138
10년 전 조회 1,098
10년 전 조회 1,214
10년 전 조회 973
10년 전 조회 1,031
10년 전 조회 1,243
10년 전 조회 1,076
10년 전 조회 1,038
10년 전 조회 1,022
10년 전 조회 1,023
10년 전 조회 1,020
10년 전 조회 1,018
10년 전 조회 1,035
10년 전 조회 1,034
10년 전 조회 1,145
10년 전 조회 994
10년 전 조회 994
10년 전 조회 1,077
10년 전 조회 1,797
10년 전 조회 1,010
10년 전 조회 1,033
10년 전 조회 1,144
10년 전 조회 1,069
10년 전 조회 1,184
10년 전 조회 1,144
10년 전 조회 1,031
10년 전 조회 1,026
10년 전 조회 1,089
10년 전 조회 1,052
10년 전 조회 997
10년 전 조회 953
10년 전 조회 919
10년 전 조회 957
10년 전 조회 1,352
10년 전 조회 974
10년 전 조회 1,089