PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1156

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,156
10년 전 조회 1,096
10년 전 조회 1,157
10년 전 조회 1,254
10년 전 조회 1,130
10년 전 조회 1,100
10년 전 조회 1,126
10년 전 조회 1,203
10년 전 조회 1,115
10년 전 조회 1,074
10년 전 조회 1,095
10년 전 조회 1,107
10년 전 조회 1,053
10년 전 조회 1,076
10년 전 조회 1,293
10년 전 조회 1,448
10년 전 조회 1,354
10년 전 조회 1,100
10년 전 조회 1,106
10년 전 조회 1,076
10년 전 조회 1,075
10년 전 조회 1,177
10년 전 조회 1,129
10년 전 조회 1,017
10년 전 조회 1,089
10년 전 조회 1,471
10년 전 조회 1,897
10년 전 조회 1,500
10년 전 조회 1,289
10년 전 조회 1,304
10년 전 조회 1,119
10년 전 조회 1,107
10년 전 조회 1,148
10년 전 조회 1,099
10년 전 조회 1,131
10년 전 조회 1,116
10년 전 조회 1,305
10년 전 조회 1,222
10년 전 조회 1,914
10년 전 조회 1,470
10년 전 조회 1,197
10년 전 조회 1,288
10년 전 조회 1,552
10년 전 조회 1,238
10년 전 조회 1,423
10년 전 조회 1,265
10년 전 조회 1,364
10년 전 조회 1,189
10년 전 조회 1,178
10년 전 조회 1,157
10년 전 조회 1,212
10년 전 조회 1,194
10년 전 조회 1,251
10년 전 조회 1,243
10년 전 조회 1,228
10년 전 조회 1,384
10년 전 조회 1,367
10년 전 조회 1,160
10년 전 조회 1,458
10년 전 조회 1,818
10년 전 조회 1,249
10년 전 조회 1,502
10년 전 조회 1,470
10년 전 조회 1,324
10년 전 조회 1,279
10년 전 조회 1,238
10년 전 조회 1,345
10년 전 조회 1,105
10년 전 조회 1,170
10년 전 조회 1,392
10년 전 조회 1,206
10년 전 조회 1,190
10년 전 조회 1,172
10년 전 조회 1,184
10년 전 조회 1,165
10년 전 조회 1,171
10년 전 조회 1,189
10년 전 조회 1,184
10년 전 조회 1,319
10년 전 조회 1,132
10년 전 조회 1,138
10년 전 조회 1,229
10년 전 조회 1,968
10년 전 조회 1,171
10년 전 조회 1,191
10년 전 조회 1,287
10년 전 조회 1,206
10년 전 조회 1,338
10년 전 조회 1,278
10년 전 조회 1,189
10년 전 조회 1,178
10년 전 조회 1,227
10년 전 조회 1,212
10년 전 조회 1,147
10년 전 조회 1,096
10년 전 조회 1,065
10년 전 조회 1,101
10년 전 조회 1,501
10년 전 조회 1,134
10년 전 조회 1,243