PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1348

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,343
10년 전 조회 1,304
10년 전 조회 1,323
10년 전 조회 1,446
10년 전 조회 1,308
10년 전 조회 1,273
10년 전 조회 1,285
10년 전 조회 1,401
10년 전 조회 1,283
10년 전 조회 1,238
10년 전 조회 1,270
10년 전 조회 1,277
10년 전 조회 1,328
10년 전 조회 1,256
10년 전 조회 1,484
10년 전 조회 1,626
10년 전 조회 1,527
10년 전 조회 1,293
10년 전 조회 1,283
10년 전 조회 1,251
10년 전 조회 1,241
10년 전 조회 1,367
10년 전 조회 1,286
10년 전 조회 1,234
10년 전 조회 1,284
10년 전 조회 1,633
10년 전 조회 2,107
10년 전 조회 1,673
10년 전 조회 1,503
10년 전 조회 1,472
10년 전 조회 1,313
10년 전 조회 1,300
10년 전 조회 1,320
10년 전 조회 1,278
10년 전 조회 1,292
10년 전 조회 1,319
10년 전 조회 1,483
10년 전 조회 1,380
10년 전 조회 2,112
10년 전 조회 1,645
10년 전 조회 1,393
10년 전 조회 1,481
10년 전 조회 1,718
10년 전 조회 1,399
10년 전 조회 1,585
10년 전 조회 1,410
10년 전 조회 1,534
10년 전 조회 1,376
10년 전 조회 1,338
10년 전 조회 1,349
10년 전 조회 1,382
10년 전 조회 1,375
10년 전 조회 1,407
10년 전 조회 1,436
10년 전 조회 1,405
10년 전 조회 1,561
10년 전 조회 1,547
10년 전 조회 1,338
10년 전 조회 1,642
10년 전 조회 1,989
10년 전 조회 1,442
10년 전 조회 1,693
10년 전 조회 1,658
10년 전 조회 1,516
10년 전 조회 1,462
10년 전 조회 1,430
10년 전 조회 1,537
10년 전 조회 1,271
10년 전 조회 1,362
10년 전 조회 1,589
10년 전 조회 1,404
10년 전 조회 1,400
10년 전 조회 1,348
10년 전 조회 1,391
10년 전 조회 1,373
10년 전 조회 1,380
10년 전 조회 1,408
10년 전 조회 1,353
10년 전 조회 1,517
10년 전 조회 1,339
10년 전 조회 1,351
10년 전 조회 1,444
10년 전 조회 2,173
10년 전 조회 1,416
10년 전 조회 1,397
10년 전 조회 1,474
10년 전 조회 1,391
10년 전 조회 1,583
10년 전 조회 1,481
10년 전 조회 1,401
10년 전 조회 1,402
10년 전 조회 1,448
10년 전 조회 1,426
10년 전 조회 1,345
10년 전 조회 1,306
10년 전 조회 1,283
10년 전 조회 1,318
10년 전 조회 1,707
10년 전 조회 1,338
10년 전 조회 1,456