PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1549

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,423
10년 전 조회 1,521
10년 전 조회 1,506
10년 전 조회 1,512
10년 전 조회 1,674
10년 전 조회 1,516
10년 전 조회 1,518
10년 전 조회 1,490
10년 전 조회 1,609
10년 전 조회 1,519
10년 전 조회 1,475
10년 전 조회 1,470
10년 전 조회 1,504
10년 전 조회 1,546
10년 전 조회 1,482
10년 전 조회 1,675
10년 전 조회 1,820
10년 전 조회 1,748
10년 전 조회 1,515
10년 전 조회 1,515
10년 전 조회 1,472
10년 전 조회 1,456
10년 전 조회 1,556
10년 전 조회 1,471
10년 전 조회 1,436
10년 전 조회 1,496
10년 전 조회 1,837
10년 전 조회 2,290
10년 전 조회 1,857
10년 전 조회 1,678
10년 전 조회 1,537
10년 전 조회 1,501
10년 전 조회 1,524
10년 전 조회 1,498
10년 전 조회 1,504
10년 전 조회 1,509
10년 전 조회 1,671
10년 전 조회 1,583
10년 전 조회 2,334
10년 전 조회 1,851
10년 전 조회 1,610
10년 전 조회 1,701
10년 전 조회 1,914
10년 전 조회 1,601
10년 전 조회 1,812
10년 전 조회 1,652
10년 전 조회 1,765
10년 전 조회 1,602
10년 전 조회 1,552
10년 전 조회 1,550
10년 전 조회 1,600
10년 전 조회 1,576
10년 전 조회 1,621
10년 전 조회 1,641
10년 전 조회 1,625
10년 전 조회 1,773
10년 전 조회 1,768
10년 전 조회 1,567
10년 전 조회 1,862
10년 전 조회 2,193
10년 전 조회 1,655
10년 전 조회 1,917
10년 전 조회 1,884
10년 전 조회 1,727
10년 전 조회 1,699
10년 전 조회 1,648
10년 전 조회 1,746
10년 전 조회 1,498
10년 전 조회 1,589
10년 전 조회 1,797
10년 전 조회 1,617
10년 전 조회 1,571
10년 전 조회 1,573
10년 전 조회 1,580
10년 전 조회 1,610
10년 전 조회 1,601
10년 전 조회 1,614
10년 전 조회 1,571
10년 전 조회 1,748
10년 전 조회 1,547
10년 전 조회 1,573
10년 전 조회 1,680
10년 전 조회 2,356
10년 전 조회 1,628
10년 전 조회 1,613
10년 전 조회 1,676
10년 전 조회 1,584
10년 전 조회 1,773
10년 전 조회 1,682
10년 전 조회 1,599
10년 전 조회 1,583
10년 전 조회 1,619
10년 전 조회 1,624
10년 전 조회 1,554
10년 전 조회 1,499
10년 전 조회 1,483
10년 전 조회 1,515
10년 전 조회 1,925
10년 전 조회 1,536
10년 전 조회 1,655