PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1607

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,499
10년 전 조회 1,603
10년 전 조회 1,581
10년 전 조회 1,580
10년 전 조회 1,724
10년 전 조회 1,579
10년 전 조회 1,585
10년 전 조회 1,560
10년 전 조회 1,667
10년 전 조회 1,580
10년 전 조회 1,544
10년 전 조회 1,546
10년 전 조회 1,571
10년 전 조회 1,607
10년 전 조회 1,544
10년 전 조회 1,740
10년 전 조회 1,892
10년 전 조회 1,817
10년 전 조회 1,587
10년 전 조회 1,578
10년 전 조회 1,520
10년 전 조회 1,526
10년 전 조회 1,622
10년 전 조회 1,533
10년 전 조회 1,497
10년 전 조회 1,547
10년 전 조회 1,897
10년 전 조회 2,358
10년 전 조회 1,935
10년 전 조회 1,745
10년 전 조회 1,593
10년 전 조회 1,567
10년 전 조회 1,586
10년 전 조회 1,552
10년 전 조회 1,564
10년 전 조회 1,564
10년 전 조회 1,732
10년 전 조회 1,639
10년 전 조회 2,388
10년 전 조회 1,907
10년 전 조회 1,668
10년 전 조회 1,755
10년 전 조회 1,971
10년 전 조회 1,653
10년 전 조회 1,883
10년 전 조회 1,708
10년 전 조회 1,813
10년 전 조회 1,650
10년 전 조회 1,609
10년 전 조회 1,608
10년 전 조회 1,652
10년 전 조회 1,627
10년 전 조회 1,689
10년 전 조회 1,697
10년 전 조회 1,685
10년 전 조회 1,836
10년 전 조회 1,838
10년 전 조회 1,632
10년 전 조회 1,930
10년 전 조회 2,243
10년 전 조회 1,715
10년 전 조회 1,976
10년 전 조회 1,932
10년 전 조회 1,783
10년 전 조회 1,763
10년 전 조회 1,702
10년 전 조회 1,809
10년 전 조회 1,565
10년 전 조회 1,646
10년 전 조회 1,859
10년 전 조회 1,678
10년 전 조회 1,629
10년 전 조회 1,632
10년 전 조회 1,647
10년 전 조회 1,675
10년 전 조회 1,654
10년 전 조회 1,668
10년 전 조회 1,629
10년 전 조회 1,798
10년 전 조회 1,607
10년 전 조회 1,630
10년 전 조회 1,736
10년 전 조회 2,417
10년 전 조회 1,684
10년 전 조회 1,656
10년 전 조회 1,740
10년 전 조회 1,636
10년 전 조회 1,818
10년 전 조회 1,729
10년 전 조회 1,653
10년 전 조회 1,640
10년 전 조회 1,669
10년 전 조회 1,673
10년 전 조회 1,599
10년 전 조회 1,547
10년 전 조회 1,535
10년 전 조회 1,563
10년 전 조회 1,987
10년 전 조회 1,589
10년 전 조회 1,705