PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1542

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,416
10년 전 조회 1,517
10년 전 조회 1,502
10년 전 조회 1,509
10년 전 조회 1,669
10년 전 조회 1,511
10년 전 조회 1,512
10년 전 조회 1,484
10년 전 조회 1,603
10년 전 조회 1,513
10년 전 조회 1,469
10년 전 조회 1,466
10년 전 조회 1,493
10년 전 조회 1,543
10년 전 조회 1,475
10년 전 조회 1,664
10년 전 조회 1,815
10년 전 조회 1,743
10년 전 조회 1,507
10년 전 조회 1,508
10년 전 조회 1,464
10년 전 조회 1,454
10년 전 조회 1,552
10년 전 조회 1,469
10년 전 조회 1,425
10년 전 조회 1,487
10년 전 조회 1,831
10년 전 조회 2,285
10년 전 조회 1,854
10년 전 조회 1,672
10년 전 조회 1,535
10년 전 조회 1,499
10년 전 조회 1,518
10년 전 조회 1,493
10년 전 조회 1,502
10년 전 조회 1,508
10년 전 조회 1,669
10년 전 조회 1,579
10년 전 조회 2,330
10년 전 조회 1,846
10년 전 조회 1,604
10년 전 조회 1,698
10년 전 조회 1,912
10년 전 조회 1,595
10년 전 조회 1,809
10년 전 조회 1,649
10년 전 조회 1,759
10년 전 조회 1,596
10년 전 조회 1,549
10년 전 조회 1,543
10년 전 조회 1,593
10년 전 조회 1,569
10년 전 조회 1,619
10년 전 조회 1,636
10년 전 조회 1,621
10년 전 조회 1,767
10년 전 조회 1,764
10년 전 조회 1,560
10년 전 조회 1,856
10년 전 조회 2,188
10년 전 조회 1,651
10년 전 조회 1,909
10년 전 조회 1,869
10년 전 조회 1,719
10년 전 조회 1,693
10년 전 조회 1,643
10년 전 조회 1,736
10년 전 조회 1,492
10년 전 조회 1,583
10년 전 조회 1,788
10년 전 조회 1,612
10년 전 조회 1,564
10년 전 조회 1,568
10년 전 조회 1,576
10년 전 조회 1,603
10년 전 조회 1,594
10년 전 조회 1,612
10년 전 조회 1,566
10년 전 조회 1,739
10년 전 조회 1,540
10년 전 조회 1,566
10년 전 조회 1,679
10년 전 조회 2,351
10년 전 조회 1,624
10년 전 조회 1,610
10년 전 조회 1,669
10년 전 조회 1,579
10년 전 조회 1,772
10년 전 조회 1,679
10년 전 조회 1,593
10년 전 조회 1,578
10년 전 조회 1,615
10년 전 조회 1,619
10년 전 조회 1,548
10년 전 조회 1,494
10년 전 조회 1,480
10년 전 조회 1,513
10년 전 조회 1,919
10년 전 조회 1,534
10년 전 조회 1,651