v

PHP ANOTATION , Reflection

· 14년 전 · 1661
PHP 에서도 anotation 드리븐을 구현 할 수 있을거 같내요 ㅎ;
 
잘만 활용 하면, 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'
 
 
 
 
 
 
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 2,415
14년 전 조회 2,642
14년 전 조회 2,181
14년 전 조회 3,192
14년 전 조회 1,853
14년 전 조회 1,883
14년 전 조회 1,699
14년 전 조회 2,488
14년 전 조회 2,126
14년 전 조회 1,815
14년 전 조회 6,368
14년 전 조회 2,973
14년 전 조회 2,228
14년 전 조회 1,724
14년 전 조회 1.1만
14년 전 조회 2,633
14년 전 조회 1,651
14년 전 조회 1,686
14년 전 조회 2,520
14년 전 조회 3,067
14년 전 조회 2,596
14년 전 조회 1,827
14년 전 조회 3,124
14년 전 조회 3,073
14년 전 조회 4,082
14년 전 조회 2,183
14년 전 조회 2,338
14년 전 조회 1,874
14년 전 조회 1,934
14년 전 조회 3,182
14년 전 조회 1,960
14년 전 조회 3,474
14년 전 조회 1,682
14년 전 조회 4,564
14년 전 조회 1,741
14년 전 조회 3,151
14년 전 조회 4,530
14년 전 조회 1,783
14년 전 조회 1,978
14년 전 조회 2,335
14년 전 조회 1,873
14년 전 조회 2,421
14년 전 조회 2,285
14년 전 조회 2,437
14년 전 조회 2,163
14년 전 조회 1,767
14년 전 조회 2,215
14년 전 조회 2,218
14년 전 조회 2,104
14년 전 조회 1,662
14년 전 조회 1,614
14년 전 조회 2,026
14년 전 조회 1,549
14년 전 조회 4,114
14년 전 조회 1,566
14년 전 조회 1,946
14년 전 조회 1,605
14년 전 조회 1,626
14년 전 조회 2,872
14년 전 조회 1,936
14년 전 조회 2,374
14년 전 조회 1,653
14년 전 조회 2,225
14년 전 조회 2,738
14년 전 조회 1,806
14년 전 조회 2,275
14년 전 조회 1,798
14년 전 조회 2,160
14년 전 조회 3,620
14년 전 조회 1,653
14년 전 조회 5,800
14년 전 조회 1,668
14년 전 조회 1,830
14년 전 조회 1,682
14년 전 조회 4,394
14년 전 조회 1,479
14년 전 조회 1,809
14년 전 조회 2,118
14년 전 조회 2,140
14년 전 조회 1,597
14년 전 조회 2,233
14년 전 조회 1,685
14년 전 조회 1,570
14년 전 조회 3,241
14년 전 조회 1,969
14년 전 조회 1,557
14년 전 조회 1,540
14년 전 조회 2,579
14년 전 조회 1,746
14년 전 조회 2,149
14년 전 조회 2,136
14년 전 조회 2,737
14년 전 조회 2,820
14년 전 조회 2,091
14년 전 조회 1,716
14년 전 조회 1,647
14년 전 조회 1,873
14년 전 조회 2,055
14년 전 조회 3,526
14년 전 조회 1,549