PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1217

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,235
10년 전 조회 1,179
10년 전 조회 1,218
10년 전 조회 1,322
10년 전 조회 1,185
10년 전 조회 1,157
10년 전 조회 1,175
10년 전 조회 1,265
10년 전 조회 1,172
10년 전 조회 1,128
10년 전 조회 1,155
10년 전 조회 1,158
10년 전 조회 1,178
10년 전 조회 1,139
10년 전 조회 1,346
10년 전 조회 1,511
10년 전 조회 1,395
10년 전 조회 1,167
10년 전 조회 1,163
10년 전 조회 1,118
10년 전 조회 1,140
10년 전 조회 1,250
10년 전 조회 1,180
10년 전 조회 1,104
10년 전 조회 1,168
10년 전 조회 1,524
10년 전 조회 1,966
10년 전 조회 1,557
10년 전 조회 1,355
10년 전 조회 1,344
10년 전 조회 1,176
10년 전 조회 1,168
10년 전 조회 1,196
10년 전 조회 1,152
10년 전 조회 1,176
10년 전 조회 1,189
10년 전 조회 1,347
10년 전 조회 1,276
10년 전 조회 1,987
10년 전 조회 1,530
10년 전 조회 1,258
10년 전 조회 1,350
10년 전 조회 1,604
10년 전 조회 1,290
10년 전 조회 1,478
10년 전 조회 1,310
10년 전 조회 1,423
10년 전 조회 1,260
10년 전 조회 1,231
10년 전 조회 1,218
10년 전 조회 1,258
10년 전 조회 1,253
10년 전 조회 1,291
10년 전 조회 1,304
10년 전 조회 1,278
10년 전 조회 1,433
10년 전 조회 1,425
10년 전 조회 1,218
10년 전 조회 1,519
10년 전 조회 1,880
10년 전 조회 1,315
10년 전 조회 1,565
10년 전 조회 1,530
10년 전 조회 1,372
10년 전 조회 1,339
10년 전 조회 1,294
10년 전 조회 1,411
10년 전 조회 1,158
10년 전 조회 1,228
10년 전 조회 1,444
10년 전 조회 1,265
10년 전 조회 1,252
10년 전 조회 1,227
10년 전 조회 1,242
10년 전 조회 1,218
10년 전 조회 1,221
10년 전 조회 1,249
10년 전 조회 1,228
10년 전 조회 1,376
10년 전 조회 1,206
10년 전 조회 1,201
10년 전 조회 1,288
10년 전 조회 2,023
10년 전 조회 1,253
10년 전 조회 1,248
10년 전 조회 1,349
10년 전 조회 1,247
10년 전 조회 1,407
10년 전 조회 1,333
10년 전 조회 1,240
10년 전 조회 1,244
10년 전 조회 1,299
10년 전 조회 1,278
10년 전 조회 1,199
10년 전 조회 1,160
10년 전 조회 1,128
10년 전 조회 1,163
10년 전 조회 1,558
10년 전 조회 1,197
10년 전 조회 1,307