PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1588

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,483
10년 전 조회 1,579
10년 전 조회 1,558
10년 전 조회 1,566
10년 전 조회 1,709
10년 전 조회 1,563
10년 전 조회 1,566
10년 전 조회 1,540
10년 전 조회 1,647
10년 전 조회 1,567
10년 전 조회 1,523
10년 전 조회 1,522
10년 전 조회 1,556
10년 전 조회 1,591
10년 전 조회 1,525
10년 전 조회 1,718
10년 전 조회 1,874
10년 전 조회 1,802
10년 전 조회 1,571
10년 전 조회 1,564
10년 전 조회 1,504
10년 전 조회 1,505
10년 전 조회 1,606
10년 전 조회 1,512
10년 전 조회 1,481
10년 전 조회 1,535
10년 전 조회 1,879
10년 전 조회 2,340
10년 전 조회 1,916
10년 전 조회 1,733
10년 전 조회 1,575
10년 전 조회 1,545
10년 전 조회 1,573
10년 전 조회 1,544
10년 전 조회 1,552
10년 전 조회 1,555
10년 전 조회 1,720
10년 전 조회 1,626
10년 전 조회 2,376
10년 전 조회 1,894
10년 전 조회 1,654
10년 전 조회 1,735
10년 전 조회 1,948
10년 전 조회 1,640
10년 전 조회 1,867
10년 전 조회 1,694
10년 전 조회 1,802
10년 전 조회 1,633
10년 전 조회 1,589
10년 전 조회 1,589
10년 전 조회 1,641
10년 전 조회 1,615
10년 전 조회 1,669
10년 전 조회 1,681
10년 전 조회 1,663
10년 전 조회 1,819
10년 전 조회 1,821
10년 전 조회 1,615
10년 전 조회 1,910
10년 전 조회 2,235
10년 전 조회 1,696
10년 전 조회 1,963
10년 전 조회 1,920
10년 전 조회 1,772
10년 전 조회 1,745
10년 전 조회 1,688
10년 전 조회 1,793
10년 전 조회 1,549
10년 전 조회 1,630
10년 전 조회 1,848
10년 전 조회 1,662
10년 전 조회 1,610
10년 전 조회 1,619
10년 전 조회 1,629
10년 전 조회 1,660
10년 전 조회 1,641
10년 전 조회 1,654
10년 전 조회 1,618
10년 전 조회 1,785
10년 전 조회 1,591
10년 전 조회 1,608
10년 전 조회 1,726
10년 전 조회 2,401
10년 전 조회 1,672
10년 전 조회 1,645
10년 전 조회 1,728
10년 전 조회 1,626
10년 전 조회 1,805
10년 전 조회 1,712
10년 전 조회 1,642
10년 전 조회 1,627
10년 전 조회 1,657
10년 전 조회 1,663
10년 전 조회 1,588
10년 전 조회 1,539
10년 전 조회 1,521
10년 전 조회 1,553
10년 전 조회 1,975
10년 전 조회 1,575
10년 전 조회 1,695