PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1178

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,187
10년 전 조회 1,120
10년 전 조회 1,184
10년 전 조회 1,285
10년 전 조회 1,155
10년 전 조회 1,130
10년 전 조회 1,153
10년 전 조회 1,228
10년 전 조회 1,143
10년 전 조회 1,097
10년 전 조회 1,125
10년 전 조회 1,127
10년 전 조회 1,077
10년 전 조회 1,098
10년 전 조회 1,311
10년 전 조회 1,472
10년 전 조회 1,370
10년 전 조회 1,126
10년 전 조회 1,128
10년 전 조회 1,092
10년 전 조회 1,102
10년 전 조회 1,198
10년 전 조회 1,145
10년 전 조회 1,044
10년 전 조회 1,114
10년 전 조회 1,491
10년 전 조회 1,922
10년 전 조회 1,516
10년 전 조회 1,312
10년 전 조회 1,326
10년 전 조회 1,141
10년 전 조회 1,134
10년 전 조회 1,165
10년 전 조회 1,121
10년 전 조회 1,148
10년 전 조회 1,143
10년 전 조회 1,320
10년 전 조회 1,247
10년 전 조회 1,958
10년 전 조회 1,500
10년 전 조회 1,225
10년 전 조회 1,317
10년 전 조회 1,578
10년 전 조회 1,262
10년 전 조회 1,448
10년 전 조회 1,279
10년 전 조회 1,387
10년 전 조회 1,220
10년 전 조회 1,201
10년 전 조회 1,179
10년 전 조회 1,235
10년 전 조회 1,223
10년 전 조회 1,269
10년 전 조회 1,268
10년 전 조회 1,246
10년 전 조회 1,402
10년 전 조회 1,397
10년 전 조회 1,185
10년 전 조회 1,486
10년 전 조회 1,844
10년 전 조회 1,274
10년 전 조회 1,529
10년 전 조회 1,495
10년 전 조회 1,350
10년 전 조회 1,302
10년 전 조회 1,266
10년 전 조회 1,374
10년 전 조회 1,130
10년 전 조회 1,194
10년 전 조회 1,415
10년 전 조회 1,228
10년 전 조회 1,220
10년 전 조회 1,193
10년 전 조회 1,205
10년 전 조회 1,188
10년 전 조회 1,192
10년 전 조회 1,213
10년 전 조회 1,213
10년 전 조회 1,342
10년 전 조회 1,160
10년 전 조회 1,164
10년 전 조회 1,248
10년 전 조회 1,988
10년 전 조회 1,200
10년 전 조회 1,217
10년 전 조회 1,311
10년 전 조회 1,222
10년 전 조회 1,364
10년 전 조회 1,301
10년 전 조회 1,213
10년 전 조회 1,210
10년 전 조회 1,258
10년 전 조회 1,243
10년 전 조회 1,164
10년 전 조회 1,124
10년 전 조회 1,091
10년 전 조회 1,127
10년 전 조회 1,523
10년 전 조회 1,156
10년 전 조회 1,267