PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1364

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,253
10년 전 조회 1,366
10년 전 조회 1,325
10년 전 조회 1,350
10년 전 조회 1,479
10년 전 조회 1,328
10년 전 조회 1,297
10년 전 조회 1,310
10년 전 조회 1,428
10년 전 조회 1,298
10년 전 조회 1,266
10년 전 조회 1,296
10년 전 조회 1,307
10년 전 조회 1,358
10년 전 조회 1,278
10년 전 조회 1,510
10년 전 조회 1,643
10년 전 조회 1,562
10년 전 조회 1,319
10년 전 조회 1,308
10년 전 조회 1,277
10년 전 조회 1,266
10년 전 조회 1,388
10년 전 조회 1,305
10년 전 조회 1,262
10년 전 조회 1,311
10년 전 조회 1,651
10년 전 조회 2,134
10년 전 조회 1,697
10년 전 조회 1,496
10년 전 조회 1,357
10년 전 조회 1,321
10년 전 조회 1,343
10년 전 조회 1,300
10년 전 조회 1,318
10년 전 조회 1,347
10년 전 조회 1,506
10년 전 조회 1,406
10년 전 조회 2,140
10년 전 조회 1,668
10년 전 조회 1,415
10년 전 조회 1,511
10년 전 조회 1,740
10년 전 조회 1,422
10년 전 조회 1,606
10년 전 조회 1,437
10년 전 조회 1,556
10년 전 조회 1,397
10년 전 조회 1,356
10년 전 조회 1,365
10년 전 조회 1,408
10년 전 조회 1,396
10년 전 조회 1,426
10년 전 조회 1,464
10년 전 조회 1,434
10년 전 조회 1,582
10년 전 조회 1,570
10년 전 조회 1,366
10년 전 조회 1,675
10년 전 조회 2,014
10년 전 조회 1,470
10년 전 조회 1,714
10년 전 조회 1,676
10년 전 조회 1,537
10년 전 조회 1,494
10년 전 조회 1,457
10년 전 조회 1,563
10년 전 조회 1,301
10년 전 조회 1,387
10년 전 조회 1,609
10년 전 조회 1,437
10년 전 조회 1,421
10년 전 조회 1,376
10년 전 조회 1,410
10년 전 조회 1,405
10년 전 조회 1,410
10년 전 조회 1,434
10년 전 조회 1,385
10년 전 조회 1,551
10년 전 조회 1,372
10년 전 조회 1,380
10년 전 조회 1,482
10년 전 조회 2,204
10년 전 조회 1,445
10년 전 조회 1,419
10년 전 조회 1,507
10년 전 조회 1,418
10년 전 조회 1,612
10년 전 조회 1,505
10년 전 조회 1,430
10년 전 조회 1,433
10년 전 조회 1,462
10년 전 조회 1,448
10년 전 조회 1,379
10년 전 조회 1,340
10년 전 조회 1,316
10년 전 조회 1,356
10년 전 조회 1,743
10년 전 조회 1,374
10년 전 조회 1,476