PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1577

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,460
10년 전 조회 1,562
10년 전 조회 1,538
10년 전 조회 1,548
10년 전 조회 1,698
10년 전 조회 1,549
10년 전 조회 1,551
10년 전 조회 1,522
10년 전 조회 1,636
10년 전 조회 1,550
10년 전 조회 1,504
10년 전 조회 1,505
10년 전 조회 1,540
10년 전 조회 1,570
10년 전 조회 1,513
10년 전 조회 1,706
10년 전 조회 1,850
10년 전 조회 1,783
10년 전 조회 1,550
10년 전 조회 1,553
10년 전 조회 1,497
10년 전 조회 1,492
10년 전 조회 1,586
10년 전 조회 1,496
10년 전 조회 1,465
10년 전 조회 1,522
10년 전 조회 1,864
10년 전 조회 2,325
10년 전 조회 1,897
10년 전 조회 1,711
10년 전 조회 1,562
10년 전 조회 1,528
10년 전 조회 1,555
10년 전 조회 1,528
10년 전 조회 1,539
10년 전 조회 1,538
10년 전 조회 1,707
10년 전 조회 1,612
10년 전 조회 2,360
10년 전 조회 1,881
10년 전 조회 1,638
10년 전 조회 1,727
10년 전 조회 1,936
10년 전 조회 1,627
10년 전 조회 1,849
10년 전 조회 1,679
10년 전 조회 1,795
10년 전 조회 1,624
10년 전 조회 1,584
10년 전 조회 1,578
10년 전 조회 1,628
10년 전 조회 1,599
10년 전 조회 1,660
10년 전 조회 1,669
10년 전 조회 1,644
10년 전 조회 1,803
10년 전 조회 1,801
10년 전 조회 1,603
10년 전 조회 1,896
10년 전 조회 2,223
10년 전 조회 1,672
10년 전 조회 1,948
10년 전 조회 1,910
10년 전 조회 1,754
10년 전 조회 1,735
10년 전 조회 1,673
10년 전 조회 1,774
10년 전 조회 1,535
10년 전 조회 1,614
10년 전 조회 1,830
10년 전 조회 1,652
10년 전 조회 1,598
10년 전 조회 1,602
10년 전 조회 1,613
10년 전 조회 1,646
10년 전 조회 1,627
10년 전 조회 1,640
10년 전 조회 1,599
10년 전 조회 1,773
10년 전 조회 1,576
10년 전 조회 1,598
10년 전 조회 1,711
10년 전 조회 2,385
10년 전 조회 1,655
10년 전 조회 1,629
10년 전 조회 1,709
10년 전 조회 1,614
10년 전 조회 1,792
10년 전 조회 1,703
10년 전 조회 1,625
10년 전 조회 1,613
10년 전 조회 1,645
10년 전 조회 1,652
10년 전 조회 1,574
10년 전 조회 1,524
10년 전 조회 1,507
10년 전 조회 1,544
10년 전 조회 1,954
10년 전 조회 1,565
10년 전 조회 1,680