PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1614

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,513
10년 전 조회 1,618
10년 전 조회 1,596
10년 전 조회 1,583
10년 전 조회 1,734
10년 전 조회 1,589
10년 전 조회 1,599
10년 전 조회 1,577
10년 전 조회 1,682
10년 전 조회 1,592
10년 전 조회 1,554
10년 전 조회 1,553
10년 전 조회 1,578
10년 전 조회 1,619
10년 전 조회 1,559
10년 전 조회 1,757
10년 전 조회 1,899
10년 전 조회 1,831
10년 전 조회 1,589
10년 전 조회 1,585
10년 전 조회 1,531
10년 전 조회 1,537
10년 전 조회 1,635
10년 전 조회 1,542
10년 전 조회 1,508
10년 전 조회 1,557
10년 전 조회 1,907
10년 전 조회 2,374
10년 전 조회 1,945
10년 전 조회 1,757
10년 전 조회 1,600
10년 전 조회 1,577
10년 전 조회 1,599
10년 전 조회 1,562
10년 전 조회 1,569
10년 전 조회 1,571
10년 전 조회 1,748
10년 전 조회 1,651
10년 전 조회 2,394
10년 전 조회 1,916
10년 전 조회 1,677
10년 전 조회 1,768
10년 전 조회 1,975
10년 전 조회 1,662
10년 전 조회 1,888
10년 전 조회 1,716
10년 전 조회 1,821
10년 전 조회 1,657
10년 전 조회 1,615
10년 전 조회 1,615
10년 전 조회 1,662
10년 전 조회 1,635
10년 전 조회 1,694
10년 전 조회 1,702
10년 전 조회 1,695
10년 전 조회 1,852
10년 전 조회 1,846
10년 전 조회 1,638
10년 전 조회 1,940
10년 전 조회 2,246
10년 전 조회 1,719
10년 전 조회 1,979
10년 전 조회 1,943
10년 전 조회 1,791
10년 전 조회 1,773
10년 전 조회 1,710
10년 전 조회 1,816
10년 전 조회 1,574
10년 전 조회 1,656
10년 전 조회 1,872
10년 전 조회 1,686
10년 전 조회 1,640
10년 전 조회 1,642
10년 전 조회 1,660
10년 전 조회 1,686
10년 전 조회 1,664
10년 전 조회 1,678
10년 전 조회 1,637
10년 전 조회 1,804
10년 전 조회 1,614
10년 전 조회 1,638
10년 전 조회 1,746
10년 전 조회 2,428
10년 전 조회 1,693
10년 전 조회 1,665
10년 전 조회 1,751
10년 전 조회 1,646
10년 전 조회 1,827
10년 전 조회 1,736
10년 전 조회 1,655
10년 전 조회 1,644
10년 전 조회 1,674
10년 전 조회 1,675
10년 전 조회 1,612
10년 전 조회 1,552
10년 전 조회 1,543
10년 전 조회 1,573
10년 전 조회 1,990
10년 전 조회 1,598
10년 전 조회 1,711