PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1599

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,486
10년 전 조회 1,592
10년 전 조회 1,568
10년 전 조회 1,573
10년 전 조회 1,716
10년 전 조회 1,571
10년 전 조회 1,573
10년 전 조회 1,546
10년 전 조회 1,654
10년 전 조회 1,574
10년 전 조회 1,526
10년 전 조회 1,533
10년 전 조회 1,563
10년 전 조회 1,598
10년 전 조회 1,534
10년 전 조회 1,730
10년 전 조회 1,877
10년 전 조회 1,805
10년 전 조회 1,580
10년 전 조회 1,569
10년 전 조회 1,511
10년 전 조회 1,515
10년 전 조회 1,610
10년 전 조회 1,521
10년 전 조회 1,489
10년 전 조회 1,537
10년 전 조회 1,886
10년 전 조회 2,344
10년 전 조회 1,923
10년 전 조회 1,739
10년 전 조회 1,582
10년 전 조회 1,552
10년 전 조회 1,577
10년 전 조회 1,548
10년 전 조회 1,556
10년 전 조회 1,559
10년 전 조회 1,724
10년 전 조회 1,636
10년 전 조회 2,383
10년 전 조회 1,899
10년 전 조회 1,657
10년 전 조회 1,738
10년 전 조회 1,958
10년 전 조회 1,641
10년 전 조회 1,871
10년 전 조회 1,696
10년 전 조회 1,809
10년 전 조회 1,638
10년 전 조회 1,598
10년 전 조회 1,600
10년 전 조회 1,646
10년 전 조회 1,618
10년 전 조회 1,678
10년 전 조회 1,686
10년 전 조회 1,671
10년 전 조회 1,829
10년 전 조회 1,827
10년 전 조회 1,626
10년 전 조회 1,919
10년 전 조회 2,236
10년 전 조회 1,699
10년 전 조회 1,967
10년 전 조회 1,924
10년 전 조회 1,777
10년 전 조회 1,751
10년 전 조회 1,694
10년 전 조회 1,803
10년 전 조회 1,554
10년 전 조회 1,635
10년 전 조회 1,851
10년 전 조회 1,667
10년 전 조회 1,618
10년 전 조회 1,626
10년 전 조회 1,636
10년 전 조회 1,663
10년 전 조회 1,645
10년 전 조회 1,662
10년 전 조회 1,625
10년 전 조회 1,793
10년 전 조회 1,597
10년 전 조회 1,617
10년 전 조회 1,731
10년 전 조회 2,409
10년 전 조회 1,675
10년 전 조회 1,649
10년 전 조회 1,736
10년 전 조회 1,630
10년 전 조회 1,810
10년 전 조회 1,718
10년 전 조회 1,649
10년 전 조회 1,629
10년 전 조회 1,662
10년 전 조회 1,663
10년 전 조회 1,595
10년 전 조회 1,540
10년 전 조회 1,525
10년 전 조회 1,557
10년 전 조회 1,975
10년 전 조회 1,580
10년 전 조회 1,696