v

PHP ANOTATION , Reflection

· 14년 전 · 1508
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,273
14년 전 조회 2,504
14년 전 조회 2,040
14년 전 조회 3,055
14년 전 조회 1,715
14년 전 조회 1,735
14년 전 조회 1,567
14년 전 조회 2,369
14년 전 조회 1,978
14년 전 조회 1,692
14년 전 조회 6,242
14년 전 조회 2,833
14년 전 조회 2,095
14년 전 조회 1,588
14년 전 조회 1만
14년 전 조회 2,487
14년 전 조회 1,521
14년 전 조회 1,521
14년 전 조회 2,393
14년 전 조회 2,927
14년 전 조회 2,456
14년 전 조회 1,691
14년 전 조회 2,972
14년 전 조회 2,925
14년 전 조회 3,940
14년 전 조회 2,048
14년 전 조회 2,204
14년 전 조회 1,740
14년 전 조회 1,784
14년 전 조회 3,033
14년 전 조회 1,820
14년 전 조회 3,311
14년 전 조회 1,544
14년 전 조회 4,435
14년 전 조회 1,610
14년 전 조회 2,990
14년 전 조회 4,392
14년 전 조회 1,653
14년 전 조회 1,833
14년 전 조회 2,192
14년 전 조회 1,732
14년 전 조회 2,274
14년 전 조회 2,141
14년 전 조회 2,261
14년 전 조회 2,019
14년 전 조회 1,617
14년 전 조회 2,089
14년 전 조회 2,074
14년 전 조회 1,944
14년 전 조회 1,509
14년 전 조회 1,476
14년 전 조회 1,892
14년 전 조회 1,395
14년 전 조회 3,968
14년 전 조회 1,407
14년 전 조회 1,810
14년 전 조회 1,446
14년 전 조회 1,481
14년 전 조회 2,727
14년 전 조회 1,789
14년 전 조회 2,220
14년 전 조회 1,510
14년 전 조회 2,091
14년 전 조회 2,592
14년 전 조회 1,661
14년 전 조회 2,125
14년 전 조회 1,677
14년 전 조회 2,023
14년 전 조회 3,475
14년 전 조회 1,514
14년 전 조회 5,672
14년 전 조회 1,518
14년 전 조회 1,691
14년 전 조회 1,540
14년 전 조회 4,233
14년 전 조회 1,334
14년 전 조회 1,680
14년 전 조회 1,975
14년 전 조회 1,982
14년 전 조회 1,465
14년 전 조회 2,085
14년 전 조회 1,551
14년 전 조회 1,433
14년 전 조회 3,081
14년 전 조회 1,831
14년 전 조회 1,415
14년 전 조회 1,401
14년 전 조회 2,440
14년 전 조회 1,603
14년 전 조회 2,005
14년 전 조회 1,994
14년 전 조회 2,608
14년 전 조회 2,667
14년 전 조회 1,945
14년 전 조회 1,578
14년 전 조회 1,507
14년 전 조회 1,732
14년 전 조회 1,934
14년 전 조회 3,381
14년 전 조회 1,403