PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1419

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,298
10년 전 조회 1,413
10년 전 조회 1,379
10년 전 조회 1,404
10년 전 조회 1,544
10년 전 조회 1,381
10년 전 조회 1,371
10년 전 조회 1,368
10년 전 조회 1,472
10년 전 조회 1,367
10년 전 조회 1,326
10년 전 조회 1,343
10년 전 조회 1,359
10년 전 조회 1,419
10년 전 조회 1,340
10년 전 조회 1,555
10년 전 조회 1,710
10년 전 조회 1,623
10년 전 조회 1,375
10년 전 조회 1,375
10년 전 조회 1,338
10년 전 조회 1,319
10년 전 조회 1,438
10년 전 조회 1,348
10년 전 조회 1,311
10년 전 조회 1,375
10년 전 조회 1,709
10년 전 조회 2,183
10년 전 조회 1,746
10년 전 조회 1,548
10년 전 조회 1,417
10년 전 조회 1,388
10년 전 조회 1,406
10년 전 조회 1,365
10년 전 조회 1,379
10년 전 조회 1,400
10년 전 조회 1,570
10년 전 조회 1,454
10년 전 조회 2,189
10년 전 조회 1,743
10년 전 조회 1,473
10년 전 조회 1,569
10년 전 조회 1,794
10년 전 조회 1,478
10년 전 조회 1,672
10년 전 조회 1,506
10년 전 조회 1,625
10년 전 조회 1,460
10년 전 조회 1,425
10년 전 조회 1,420
10년 전 조회 1,466
10년 전 조회 1,458
10년 전 조회 1,494
10년 전 조회 1,525
10년 전 조회 1,493
10년 전 조회 1,642
10년 전 조회 1,628
10년 전 조회 1,428
10년 전 조회 1,738
10년 전 조회 2,062
10년 전 조회 1,529
10년 전 조회 1,776
10년 전 조회 1,744
10년 전 조회 1,585
10년 전 조회 1,568
10년 전 조회 1,522
10년 전 조회 1,621
10년 전 조회 1,370
10년 전 조회 1,447
10년 전 조회 1,665
10년 전 조회 1,487
10년 전 조회 1,458
10년 전 조회 1,435
10년 전 조회 1,461
10년 전 조회 1,477
10년 전 조회 1,465
10년 전 조회 1,488
10년 전 조회 1,437
10년 전 조회 1,606
10년 전 조회 1,438
10년 전 조회 1,444
10년 전 조회 1,554
10년 전 조회 2,263
10년 전 조회 1,511
10년 전 조회 1,476
10년 전 조회 1,562
10년 전 조회 1,479
10년 전 조회 1,660
10년 전 조회 1,566
10년 전 조회 1,483
10년 전 조회 1,476
10년 전 조회 1,511
10년 전 조회 1,503
10년 전 조회 1,435
10년 전 조회 1,390
10년 전 조회 1,370
10년 전 조회 1,410
10년 전 조회 1,804
10년 전 조회 1,435
10년 전 조회 1,534