PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1331

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,331
10년 전 조회 1,297
10년 전 조회 1,313
10년 전 조회 1,429
10년 전 조회 1,297
10년 전 조회 1,256
10년 전 조회 1,273
10년 전 조회 1,388
10년 전 조회 1,270
10년 전 조회 1,226
10년 전 조회 1,254
10년 전 조회 1,267
10년 전 조회 1,324
10년 전 조회 1,251
10년 전 조회 1,469
10년 전 조회 1,619
10년 전 조회 1,514
10년 전 조회 1,280
10년 전 조회 1,272
10년 전 조회 1,239
10년 전 조회 1,230
10년 전 조회 1,352
10년 전 조회 1,278
10년 전 조회 1,223
10년 전 조회 1,277
10년 전 조회 1,628
10년 전 조회 2,086
10년 전 조회 1,662
10년 전 조회 1,494
10년 전 조회 1,462
10년 전 조회 1,302
10년 전 조회 1,292
10년 전 조회 1,307
10년 전 조회 1,265
10년 전 조회 1,279
10년 전 조회 1,309
10년 전 조회 1,472
10년 전 조회 1,374
10년 전 조회 2,100
10년 전 조회 1,635
10년 전 조회 1,383
10년 전 조회 1,467
10년 전 조회 1,716
10년 전 조회 1,392
10년 전 조회 1,578
10년 전 조회 1,403
10년 전 조회 1,526
10년 전 조회 1,368
10년 전 조회 1,334
10년 전 조회 1,332
10년 전 조회 1,370
10년 전 조회 1,366
10년 전 조회 1,397
10년 전 조회 1,425
10년 전 조회 1,397
10년 전 조회 1,552
10년 전 조회 1,536
10년 전 조회 1,328
10년 전 조회 1,630
10년 전 조회 1,981
10년 전 조회 1,430
10년 전 조회 1,683
10년 전 조회 1,645
10년 전 조회 1,501
10년 전 조회 1,445
10년 전 조회 1,414
10년 전 조회 1,530
10년 전 조회 1,260
10년 전 조회 1,356
10년 전 조회 1,575
10년 전 조회 1,392
10년 전 조회 1,391
10년 전 조회 1,338
10년 전 조회 1,383
10년 전 조회 1,365
10년 전 조회 1,370
10년 전 조회 1,402
10년 전 조회 1,333
10년 전 조회 1,506
10년 전 조회 1,331
10년 전 조회 1,341
10년 전 조회 1,432
10년 전 조회 2,159
10년 전 조회 1,401
10년 전 조회 1,387
10년 전 조회 1,469
10년 전 조회 1,383
10년 전 조회 1,569
10년 전 조회 1,470
10년 전 조회 1,391
10년 전 조회 1,388
10년 전 조회 1,439
10년 전 조회 1,412
10년 전 조회 1,335
10년 전 조회 1,290
10년 전 조회 1,264
10년 전 조회 1,309
10년 전 조회 1,692
10년 전 조회 1,326
10년 전 조회 1,449