PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1080

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,066
10년 전 조회 1,016
10년 전 조회 1,074
10년 전 조회 1,169
10년 전 조회 1,043
10년 전 조회 1,017
10년 전 조회 1,040
10년 전 조회 1,138
10년 전 조회 1,046
10년 전 조회 1,003
10년 전 조회 1,015
10년 전 조회 1,037
10년 전 조회 983
10년 전 조회 986
10년 전 조회 1,251
10년 전 조회 1,367
10년 전 조회 1,294
10년 전 조회 1,011
10년 전 조회 1,019
10년 전 조회 996
10년 전 조회 999
10년 전 조회 1,099
10년 전 조회 1,061
10년 전 조회 935
10년 전 조회 1,015
10년 전 조회 1,400
10년 전 조회 1,824
10년 전 조회 1,415
10년 전 조회 1,203
10년 전 조회 1,253
10년 전 조회 1,032
10년 전 조회 1,026
10년 전 조회 1,065
10년 전 조회 1,001
10년 전 조회 1,045
10년 전 조회 1,026
10년 전 조회 1,255
10년 전 조회 1,144
10년 전 조회 1,820
10년 전 조회 1,391
10년 전 조회 1,108
10년 전 조회 1,204
10년 전 조회 1,451
10년 전 조회 1,152
10년 전 조회 1,334
10년 전 조회 1,167
10년 전 조회 1,278
10년 전 조회 1,110
10년 전 조회 1,087
10년 전 조회 1,081
10년 전 조회 1,132
10년 전 조회 1,111
10년 전 조회 1,172
10년 전 조회 1,159
10년 전 조회 1,142
10년 전 조회 1,291
10년 전 조회 1,276
10년 전 조회 1,069
10년 전 조회 1,372
10년 전 조회 1,730
10년 전 조회 1,178
10년 전 조회 1,424
10년 전 조회 1,380
10년 전 조회 1,237
10년 전 조회 1,190
10년 전 조회 1,154
10년 전 조회 1,271
10년 전 조회 1,022
10년 전 조회 1,081
10년 전 조회 1,303
10년 전 조회 1,127
10년 전 조회 1,100
10년 전 조회 1,082
10년 전 조회 1,081
10년 전 조회 1,072
10년 전 조회 1,072
10년 전 조회 1,098
10년 전 조회 1,087
10년 전 조회 1,220
10년 전 조회 1,046
10년 전 조회 1,048
10년 전 조회 1,130
10년 전 조회 1,866
10년 전 조회 1,081
10년 전 조회 1,092
10년 전 조회 1,199
10년 전 조회 1,123
10년 전 조회 1,245
10년 전 조회 1,203
10년 전 조회 1,095
10년 전 조회 1,085
10년 전 조회 1,143
10년 전 조회 1,114
10년 전 조회 1,056
10년 전 조회 1,018
10년 전 조회 972
10년 전 조회 1,010
10년 전 조회 1,407
10년 전 조회 1,038
10년 전 조회 1,151