PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1550

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,513
10년 전 조회 1,674
10년 전 조회 1,516
10년 전 조회 1,520
10년 전 조회 1,490
10년 전 조회 1,609
10년 전 조회 1,520
10년 전 조회 1,475
10년 전 조회 1,471
10년 전 조회 1,505
10년 전 조회 1,546
10년 전 조회 1,483
10년 전 조회 1,675
10년 전 조회 1,821
10년 전 조회 1,749
10년 전 조회 1,517
10년 전 조회 1,515
10년 전 조회 1,472
10년 전 조회 1,456
10년 전 조회 1,557
10년 전 조회 1,473
10년 전 조회 1,436
10년 전 조회 1,496
10년 전 조회 1,838
10년 전 조회 2,290
10년 전 조회 1,862
10년 전 조회 1,678
10년 전 조회 1,537
10년 전 조회 1,501
10년 전 조회 1,524
10년 전 조회 1,499
10년 전 조회 1,504
10년 전 조회 1,509
10년 전 조회 1,671
10년 전 조회 1,584
10년 전 조회 2,334
10년 전 조회 1,852
10년 전 조회 1,610
10년 전 조회 1,702
10년 전 조회 1,914
10년 전 조회 1,601
10년 전 조회 1,813
10년 전 조회 1,652
10년 전 조회 1,766
10년 전 조회 1,603
10년 전 조회 1,553
10년 전 조회 1,551
10년 전 조회 1,600
10년 전 조회 1,577
10년 전 조회 1,621
10년 전 조회 1,641
10년 전 조회 1,625
10년 전 조회 1,774
10년 전 조회 1,768
10년 전 조회 1,568
10년 전 조회 1,862
10년 전 조회 2,194
10년 전 조회 1,655
10년 전 조회 1,917
10년 전 조회 1,885
10년 전 조회 1,729
10년 전 조회 1,702
10년 전 조회 1,648
10년 전 조회 1,747
10년 전 조회 1,500
10년 전 조회 1,590
10년 전 조회 1,800
10년 전 조회 1,617
10년 전 조회 1,571
10년 전 조회 1,573
10년 전 조회 1,580
10년 전 조회 1,610
10년 전 조회 1,601
10년 전 조회 1,615
10년 전 조회 1,571
10년 전 조회 1,748
10년 전 조회 1,547
10년 전 조회 1,574
10년 전 조회 1,681
10년 전 조회 2,358
10년 전 조회 1,629
10년 전 조회 1,613
10년 전 조회 1,678
10년 전 조회 1,585
10년 전 조회 1,773
10년 전 조회 1,682
10년 전 조회 1,599
10년 전 조회 1,584
10년 전 조회 1,619
10년 전 조회 1,625
10년 전 조회 1,555
10년 전 조회 1,499
10년 전 조회 1,483
10년 전 조회 1,517
10년 전 조회 1,926
10년 전 조회 1,537
10년 전 조회 1,655