PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1388

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,272
10년 전 조회 1,384
10년 전 조회 1,351
10년 전 조회 1,373
10년 전 조회 1,508
10년 전 조회 1,350
10년 전 조회 1,334
10년 전 조회 1,329
10년 전 조회 1,442
10년 전 조회 1,330
10년 전 조회 1,286
10년 전 조회 1,322
10년 전 조회 1,330
10년 전 조회 1,384
10년 전 조회 1,305
10년 전 조회 1,526
10년 전 조회 1,676
10년 전 조회 1,585
10년 전 조회 1,341
10년 전 조회 1,338
10년 전 조회 1,306
10년 전 조회 1,293
10년 전 조회 1,405
10년 전 조회 1,324
10년 전 조회 1,283
10년 전 조회 1,334
10년 전 조회 1,676
10년 전 조회 2,151
10년 전 조회 1,718
10년 전 조회 1,516
10년 전 조회 1,377
10년 전 조회 1,343
10년 전 조회 1,369
10년 전 조회 1,325
10년 전 조회 1,348
10년 전 조회 1,366
10년 전 조회 1,534
10년 전 조회 1,423
10년 전 조회 2,161
10년 전 조회 1,700
10년 전 조회 1,442
10년 전 조회 1,531
10년 전 조회 1,763
10년 전 조회 1,447
10년 전 조회 1,631
10년 전 조회 1,465
10년 전 조회 1,582
10년 전 조회 1,426
10년 전 조회 1,385
10년 전 조회 1,389
10년 전 조회 1,432
10년 전 조회 1,428
10년 전 조회 1,456
10년 전 조회 1,492
10년 전 조회 1,460
10년 전 조회 1,613
10년 전 조회 1,594
10년 전 조회 1,393
10년 전 조회 1,703
10년 전 조회 2,034
10년 전 조회 1,497
10년 전 조회 1,736
10년 전 조회 1,704
10년 전 조회 1,554
10년 전 조회 1,518
10년 전 조회 1,487
10년 전 조회 1,590
10년 전 조회 1,328
10년 전 조회 1,412
10년 전 조회 1,627
10년 전 조회 1,456
10년 전 조회 1,439
10년 전 조회 1,404
10년 전 조회 1,431
10년 전 조회 1,439
10년 전 조회 1,430
10년 전 조회 1,463
10년 전 조회 1,408
10년 전 조회 1,574
10년 전 조회 1,405
10년 전 조회 1,406
10년 전 조회 1,511
10년 전 조회 2,229
10년 전 조회 1,477
10년 전 조회 1,443
10년 전 조회 1,532
10년 전 조회 1,445
10년 전 조회 1,632
10년 전 조회 1,531
10년 전 조회 1,451
10년 전 조회 1,453
10년 전 조회 1,478
10년 전 조회 1,466
10년 전 조회 1,400
10년 전 조회 1,363
10년 전 조회 1,341
10년 전 조회 1,374
10년 전 조회 1,769
10년 전 조회 1,398
10년 전 조회 1,498