PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1460

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,334
10년 전 조회 1,441
10년 전 조회 1,417
10년 전 조회 1,438
10년 전 조회 1,585
10년 전 조회 1,417
10년 전 조회 1,422
10년 전 조회 1,405
10년 전 조회 1,515
10년 전 조회 1,420
10년 전 조회 1,372
10년 전 조회 1,386
10년 전 조회 1,407
10년 전 조회 1,452
10년 전 조회 1,382
10년 전 조회 1,595
10년 전 조회 1,749
10년 전 조회 1,659
10년 전 조회 1,424
10년 전 조회 1,422
10년 전 조회 1,378
10년 전 조회 1,368
10년 전 조회 1,475
10년 전 조회 1,392
10년 전 조회 1,342
10년 전 조회 1,409
10년 전 조회 1,751
10년 전 조회 2,222
10년 전 조회 1,780
10년 전 조회 1,580
10년 전 조회 1,458
10년 전 조회 1,425
10년 전 조회 1,440
10년 전 조회 1,400
10년 전 조회 1,419
10년 전 조회 1,435
10년 전 조회 1,603
10년 전 조회 1,499
10년 전 조회 2,238
10년 전 조회 1,778
10년 전 조회 1,521
10년 전 조회 1,610
10년 전 조회 1,837
10년 전 조회 1,509
10년 전 조회 1,718
10년 전 조회 1,551
10년 전 조회 1,671
10년 전 조회 1,507
10년 전 조회 1,465
10년 전 조회 1,461
10년 전 조회 1,512
10년 전 조회 1,494
10년 전 조회 1,543
10년 전 조회 1,557
10년 전 조회 1,537
10년 전 조회 1,678
10년 전 조회 1,681
10년 전 조회 1,470
10년 전 조회 1,784
10년 전 조회 2,106
10년 전 조회 1,564
10년 전 조회 1,818
10년 전 조회 1,788
10년 전 조회 1,634
10년 전 조회 1,607
10년 전 조회 1,550
10년 전 조회 1,660
10년 전 조회 1,412
10년 전 조회 1,486
10년 전 조회 1,702
10년 전 조회 1,525
10년 전 조회 1,485
10년 전 조회 1,474
10년 전 조회 1,492
10년 전 조회 1,511
10년 전 조회 1,496
10년 전 조회 1,527
10년 전 조회 1,484
10년 전 조회 1,647
10년 전 조회 1,466
10년 전 조회 1,487
10년 전 조회 1,592
10년 전 조회 2,290
10년 전 조회 1,546
10년 전 조회 1,520
10년 전 조회 1,597
10년 전 조회 1,507
10년 전 조회 1,694
10년 전 조회 1,601
10년 전 조회 1,510
10년 전 조회 1,508
10년 전 조회 1,547
10년 전 조회 1,548
10년 전 조회 1,475
10년 전 조회 1,425
10년 전 조회 1,408
10년 전 조회 1,448
10년 전 조회 1,849
10년 전 조회 1,468
10년 전 조회 1,572