PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1433

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,308
10년 전 조회 1,421
10년 전 조회 1,393
10년 전 조회 1,415
10년 전 조회 1,552
10년 전 조회 1,394
10년 전 조회 1,387
10년 전 조회 1,383
10년 전 조회 1,483
10년 전 조회 1,382
10년 전 조회 1,341
10년 전 조회 1,358
10년 전 조회 1,368
10년 전 조회 1,430
10년 전 조회 1,357
10년 전 조회 1,567
10년 전 조회 1,716
10년 전 조회 1,630
10년 전 조회 1,388
10년 전 조회 1,392
10년 전 조회 1,352
10년 전 조회 1,334
10년 전 조회 1,448
10년 전 조회 1,362
10년 전 조회 1,322
10년 전 조회 1,386
10년 전 조회 1,724
10년 전 조회 2,195
10년 전 조회 1,762
10년 전 조회 1,560
10년 전 조회 1,428
10년 전 조회 1,402
10년 전 조회 1,416
10년 전 조회 1,374
10년 전 조회 1,399
10년 전 조회 1,412
10년 전 조회 1,581
10년 전 조회 1,466
10년 전 조회 2,208
10년 전 조회 1,753
10년 전 조회 1,487
10년 전 조회 1,580
10년 전 조회 1,810
10년 전 조회 1,485
10년 전 조회 1,691
10년 전 조회 1,524
10년 전 조회 1,633
10년 전 조회 1,473
10년 전 조회 1,438
10년 전 조회 1,434
10년 전 조회 1,480
10년 전 조회 1,469
10년 전 조회 1,513
10년 전 조회 1,536
10년 전 조회 1,504
10년 전 조회 1,650
10년 전 조회 1,644
10년 전 조회 1,441
10년 전 조회 1,757
10년 전 조회 2,077
10년 전 조회 1,542
10년 전 조회 1,792
10년 전 조회 1,755
10년 전 조회 1,601
10년 전 조회 1,584
10년 전 조회 1,531
10년 전 조회 1,636
10년 전 조회 1,382
10년 전 조회 1,458
10년 전 조회 1,673
10년 전 조회 1,500
10년 전 조회 1,469
10년 전 조회 1,450
10년 전 조회 1,471
10년 전 조회 1,485
10년 전 조회 1,477
10년 전 조회 1,504
10년 전 조회 1,456
10년 전 조회 1,623
10년 전 조회 1,444
10년 전 조회 1,462
10년 전 조회 1,572
10년 전 조회 2,271
10년 전 조회 1,523
10년 전 조회 1,494
10년 전 조회 1,581
10년 전 조회 1,491
10년 전 조회 1,673
10년 전 조회 1,577
10년 전 조회 1,489
10년 전 조회 1,488
10년 전 조회 1,522
10년 전 조회 1,515
10년 전 조회 1,450
10년 전 조회 1,405
10년 전 조회 1,386
10년 전 조회 1,421
10년 전 조회 1,828
10년 전 조회 1,445
10년 전 조회 1,546