PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1333

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,334
10년 전 조회 1,300
10년 전 조회 1,314
10년 전 조회 1,435
10년 전 조회 1,300
10년 전 조회 1,257
10년 전 조회 1,274
10년 전 조회 1,395
10년 전 조회 1,271
10년 전 조회 1,230
10년 전 조회 1,259
10년 전 조회 1,270
10년 전 조회 1,325
10년 전 조회 1,253
10년 전 조회 1,471
10년 전 조회 1,619
10년 전 조회 1,516
10년 전 조회 1,283
10년 전 조회 1,276
10년 전 조회 1,242
10년 전 조회 1,234
10년 전 조회 1,353
10년 전 조회 1,280
10년 전 조회 1,225
10년 전 조회 1,278
10년 전 조회 1,629
10년 전 조회 2,091
10년 전 조회 1,666
10년 전 조회 1,496
10년 전 조회 1,466
10년 전 조회 1,303
10년 전 조회 1,292
10년 전 조회 1,308
10년 전 조회 1,268
10년 전 조회 1,283
10년 전 조회 1,312
10년 전 조회 1,473
10년 전 조회 1,376
10년 전 조회 2,101
10년 전 조회 1,637
10년 전 조회 1,383
10년 전 조회 1,472
10년 전 조회 1,716
10년 전 조회 1,394
10년 전 조회 1,578
10년 전 조회 1,406
10년 전 조회 1,529
10년 전 조회 1,371
10년 전 조회 1,335
10년 전 조회 1,334
10년 전 조회 1,371
10년 전 조회 1,368
10년 전 조회 1,399
10년 전 조회 1,425
10년 전 조회 1,399
10년 전 조회 1,554
10년 전 조회 1,538
10년 전 조회 1,331
10년 전 조회 1,633
10년 전 조회 1,983
10년 전 조회 1,431
10년 전 조회 1,684
10년 전 조회 1,646
10년 전 조회 1,504
10년 전 조회 1,447
10년 전 조회 1,417
10년 전 조회 1,531
10년 전 조회 1,262
10년 전 조회 1,358
10년 전 조회 1,578
10년 전 조회 1,395
10년 전 조회 1,392
10년 전 조회 1,340
10년 전 조회 1,385
10년 전 조회 1,366
10년 전 조회 1,371
10년 전 조회 1,402
10년 전 조회 1,337
10년 전 조회 1,508
10년 전 조회 1,332
10년 전 조회 1,344
10년 전 조회 1,434
10년 전 조회 2,163
10년 전 조회 1,401
10년 전 조회 1,389
10년 전 조회 1,469
10년 전 조회 1,386
10년 전 조회 1,572
10년 전 조회 1,470
10년 전 조회 1,392
10년 전 조회 1,392
10년 전 조회 1,440
10년 전 조회 1,416
10년 전 조회 1,337
10년 전 조회 1,295
10년 전 조회 1,267
10년 전 조회 1,313
10년 전 조회 1,696
10년 전 조회 1,329
10년 전 조회 1,449