PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1411

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,292
10년 전 조회 1,406
10년 전 조회 1,368
10년 전 조회 1,398
10년 전 조회 1,536
10년 전 조회 1,373
10년 전 조회 1,364
10년 전 조회 1,358
10년 전 조회 1,464
10년 전 조회 1,360
10년 전 조회 1,312
10년 전 조회 1,337
10년 전 조회 1,353
10년 전 조회 1,413
10년 전 조회 1,333
10년 전 조회 1,546
10년 전 조회 1,703
10년 전 조회 1,619
10년 전 조회 1,373
10년 전 조회 1,366
10년 전 조회 1,327
10년 전 조회 1,313
10년 전 조회 1,435
10년 전 조회 1,339
10년 전 조회 1,306
10년 전 조회 1,367
10년 전 조회 1,702
10년 전 조회 2,177
10년 전 조회 1,741
10년 전 조회 1,542
10년 전 조회 1,408
10년 전 조회 1,378
10년 전 조회 1,393
10년 전 조회 1,354
10년 전 조회 1,375
10년 전 조회 1,389
10년 전 조회 1,562
10년 전 조회 1,444
10년 전 조회 2,181
10년 전 조회 1,737
10년 전 조회 1,465
10년 전 조회 1,563
10년 전 조회 1,781
10년 전 조회 1,466
10년 전 조회 1,659
10년 전 조회 1,497
10년 전 조회 1,613
10년 전 조회 1,449
10년 전 조회 1,412
10년 전 조회 1,412
10년 전 조회 1,458
10년 전 조회 1,451
10년 전 조회 1,479
10년 전 조회 1,516
10년 전 조회 1,484
10년 전 조회 1,634
10년 전 조회 1,621
10년 전 조회 1,416
10년 전 조회 1,731
10년 전 조회 2,053
10년 전 조회 1,522
10년 전 조회 1,767
10년 전 조회 1,729
10년 전 조회 1,577
10년 전 조회 1,556
10년 전 조회 1,511
10년 전 조회 1,617
10년 전 조회 1,357
10년 전 조회 1,433
10년 전 조회 1,659
10년 전 조회 1,482
10년 전 조회 1,455
10년 전 조회 1,425
10년 전 조회 1,450
10년 전 조회 1,469
10년 전 조회 1,458
10년 전 조회 1,480
10년 전 조회 1,426
10년 전 조회 1,600
10년 전 조회 1,429
10년 전 조회 1,432
10년 전 조회 1,540
10년 전 조회 2,250
10년 전 조회 1,502
10년 전 조회 1,466
10년 전 조회 1,556
10년 전 조회 1,472
10년 전 조회 1,653
10년 전 조회 1,555
10년 전 조회 1,472
10년 전 조회 1,471
10년 전 조회 1,498
10년 전 조회 1,493
10년 전 조회 1,428
10년 전 조회 1,381
10년 전 조회 1,361
10년 전 조회 1,402
10년 전 조회 1,792
10년 전 조회 1,431
10년 전 조회 1,522