PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1501

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,376
10년 전 조회 1,482
10년 전 조회 1,469
10년 전 조회 1,488
10년 전 조회 1,635
10년 전 조회 1,472
10년 전 조회 1,481
10년 전 조회 1,451
10년 전 조회 1,564
10년 전 조회 1,468
10년 전 조회 1,435
10년 전 조회 1,438
10년 전 조회 1,458
10년 전 조회 1,496
10년 전 조회 1,435
10년 전 조회 1,632
10년 전 조회 1,788
10년 전 조회 1,711
10년 전 조회 1,476
10년 전 조회 1,471
10년 전 조회 1,432
10년 전 조회 1,420
10년 전 조회 1,513
10년 전 조회 1,434
10년 전 조회 1,387
10년 전 조회 1,450
10년 전 조회 1,789
10년 전 조회 2,261
10년 전 조회 1,830
10년 전 조회 1,629
10년 전 조회 1,502
10년 전 조회 1,472
10년 전 조회 1,487
10년 전 조회 1,449
10년 전 조회 1,465
10년 전 조회 1,470
10년 전 조회 1,640
10년 전 조회 1,543
10년 전 조회 2,291
10년 전 조회 1,814
10년 전 조회 1,561
10년 전 조회 1,664
10년 전 조회 1,874
10년 전 조회 1,562
10년 전 조회 1,769
10년 전 조회 1,599
10년 전 조회 1,727
10년 전 조회 1,559
10년 전 조회 1,511
10년 전 조회 1,502
10년 전 조회 1,563
10년 전 조회 1,537
10년 전 조회 1,588
10년 전 조회 1,595
10년 전 조회 1,585
10년 전 조회 1,730
10년 전 조회 1,729
10년 전 조회 1,532
10년 전 조회 1,819
10년 전 조회 2,150
10년 전 조회 1,616
10년 전 조회 1,861
10년 전 조회 1,833
10년 전 조회 1,684
10년 전 조회 1,653
10년 전 조회 1,606
10년 전 조회 1,705
10년 전 조회 1,457
10년 전 조회 1,536
10년 전 조회 1,759
10년 전 조회 1,575
10년 전 조회 1,530
10년 전 조회 1,520
10년 전 조회 1,541
10년 전 조회 1,568
10년 전 조회 1,542
10년 전 조회 1,581
10년 전 조회 1,532
10년 전 조회 1,703
10년 전 조회 1,504
10년 전 조회 1,528
10년 전 조회 1,643
10년 전 조회 2,327
10년 전 조회 1,592
10년 전 조회 1,569
10년 전 조회 1,648
10년 전 조회 1,549
10년 전 조회 1,740
10년 전 조회 1,647
10년 전 조회 1,558
10년 전 조회 1,549
10년 전 조회 1,589
10년 전 조회 1,590
10년 전 조회 1,523
10년 전 조회 1,460
10년 전 조회 1,446
10년 전 조회 1,484
10년 전 조회 1,893
10년 전 조회 1,504
10년 전 조회 1,615