PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1523

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,395
10년 전 조회 1,500
10년 전 조회 1,487
10년 전 조회 1,503
10년 전 조회 1,655
10년 전 조회 1,494
10년 전 조회 1,501
10년 전 조회 1,471
10년 전 조회 1,587
10년 전 조회 1,483
10년 전 조회 1,456
10년 전 조회 1,453
10년 전 조회 1,477
10년 전 조회 1,517
10년 전 조회 1,461
10년 전 조회 1,647
10년 전 조회 1,802
10년 전 조회 1,725
10년 전 조회 1,487
10년 전 조회 1,491
10년 전 조회 1,446
10년 전 조회 1,438
10년 전 조회 1,536
10년 전 조회 1,449
10년 전 조회 1,407
10년 전 조회 1,465
10년 전 조회 1,808
10년 전 조회 2,274
10년 전 조회 1,845
10년 전 조회 1,652
10년 전 조회 1,517
10년 전 조회 1,488
10년 전 조회 1,501
10년 전 조회 1,466
10년 전 조회 1,488
10년 전 조회 1,493
10년 전 조회 1,658
10년 전 조회 1,559
10년 전 조회 2,308
10년 전 조회 1,829
10년 전 조회 1,584
10년 전 조회 1,683
10년 전 조회 1,897
10년 전 조회 1,582
10년 전 조회 1,793
10년 전 조회 1,631
10년 전 조회 1,743
10년 전 조회 1,580
10년 전 조회 1,536
10년 전 조회 1,524
10년 전 조회 1,578
10년 전 조회 1,554
10년 전 조회 1,611
10년 전 조회 1,616
10년 전 조회 1,601
10년 전 조회 1,746
10년 전 조회 1,758
10년 전 조회 1,550
10년 전 조회 1,844
10년 전 조회 2,169
10년 전 조회 1,633
10년 전 조회 1,891
10년 전 조회 1,852
10년 전 조회 1,710
10년 전 조회 1,680
10년 전 조회 1,630
10년 전 조회 1,728
10년 전 조회 1,476
10년 전 조회 1,560
10년 전 조회 1,771
10년 전 조회 1,594
10년 전 조회 1,555
10년 전 조회 1,544
10년 전 조회 1,560
10년 전 조회 1,586
10년 전 조회 1,577
10년 전 조회 1,596
10년 전 조회 1,555
10년 전 조회 1,723
10년 전 조회 1,519
10년 전 조회 1,546
10년 전 조회 1,660
10년 전 조회 2,341
10년 전 조회 1,609
10년 전 조회 1,593
10년 전 조회 1,662
10년 전 조회 1,570
10년 전 조회 1,759
10년 전 조회 1,668
10년 전 조회 1,579
10년 전 조회 1,563
10년 전 조회 1,597
10년 전 조회 1,610
10년 전 조회 1,535
10년 전 조회 1,480
10년 전 조회 1,465
10년 전 조회 1,498
10년 전 조회 1,907
10년 전 조회 1,524
10년 전 조회 1,637