PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1379

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,264
10년 전 조회 1,376
10년 전 조회 1,341
10년 전 조회 1,362
10년 전 조회 1,492
10년 전 조회 1,337
10년 전 조회 1,315
10년 전 조회 1,321
10년 전 조회 1,433
10년 전 조회 1,313
10년 전 조회 1,280
10년 전 조회 1,311
10년 전 조회 1,321
10년 전 조회 1,371
10년 전 조회 1,294
10년 전 조회 1,520
10년 전 조회 1,661
10년 전 조회 1,578
10년 전 조회 1,332
10년 전 조회 1,324
10년 전 조회 1,288
10년 전 조회 1,277
10년 전 조회 1,400
10년 전 조회 1,315
10년 전 조회 1,277
10년 전 조회 1,325
10년 전 조회 1,663
10년 전 조회 2,141
10년 전 조회 1,710
10년 전 조회 1,505
10년 전 조회 1,366
10년 전 조회 1,333
10년 전 조회 1,356
10년 전 조회 1,312
10년 전 조회 1,337
10년 전 조회 1,355
10년 전 조회 1,528
10년 전 조회 1,411
10년 전 조회 2,151
10년 전 조회 1,685
10년 전 조회 1,433
10년 전 조회 1,516
10년 전 조회 1,747
10년 전 조회 1,438
10년 전 조회 1,618
10년 전 조회 1,453
10년 전 조회 1,565
10년 전 조회 1,413
10년 전 조회 1,367
10년 전 조회 1,380
10년 전 조회 1,421
10년 전 조회 1,417
10년 전 조회 1,442
10년 전 조회 1,483
10년 전 조회 1,445
10년 전 조회 1,603
10년 전 조회 1,581
10년 전 조회 1,379
10년 전 조회 1,688
10년 전 조회 2,020
10년 전 조회 1,484
10년 전 조회 1,727
10년 전 조회 1,690
10년 전 조회 1,546
10년 전 조회 1,510
10년 전 조회 1,475
10년 전 조회 1,572
10년 전 조회 1,317
10년 전 조회 1,404
10년 전 조회 1,623
10년 전 조회 1,451
10년 전 조회 1,430
10년 전 조회 1,392
10년 전 조회 1,420
10년 전 조회 1,426
10년 전 조회 1,424
10년 전 조회 1,451
10년 전 조회 1,401
10년 전 조회 1,565
10년 전 조회 1,390
10년 전 조회 1,396
10년 전 조회 1,497
10년 전 조회 2,217
10년 전 조회 1,458
10년 전 조회 1,429
10년 전 조회 1,524
10년 전 조회 1,432
10년 전 조회 1,627
10년 전 조회 1,520
10년 전 조회 1,443
10년 전 조회 1,444
10년 전 조회 1,469
10년 전 조회 1,458
10년 전 조회 1,387
10년 전 조회 1,355
10년 전 조회 1,328
10년 전 조회 1,368
10년 전 조회 1,755
10년 전 조회 1,383
10년 전 조회 1,486