PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1339

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,337
10년 전 조회 1,301
10년 전 조회 1,316
10년 전 조회 1,436
10년 전 조회 1,303
10년 전 조회 1,264
10년 전 조회 1,276
10년 전 조회 1,398
10년 전 조회 1,277
10년 전 조회 1,232
10년 전 조회 1,263
10년 전 조회 1,273
10년 전 조회 1,325
10년 전 조회 1,254
10년 전 조회 1,479
10년 전 조회 1,619
10년 전 조회 1,519
10년 전 조회 1,285
10년 전 조회 1,278
10년 전 조회 1,246
10년 전 조회 1,240
10년 전 조회 1,358
10년 전 조회 1,284
10년 전 조회 1,230
10년 전 조회 1,280
10년 전 조회 1,630
10년 전 조회 2,098
10년 전 조회 1,668
10년 전 조회 1,496
10년 전 조회 1,467
10년 전 조회 1,305
10년 전 조회 1,297
10년 전 조회 1,312
10년 전 조회 1,274
10년 전 조회 1,286
10년 전 조회 1,312
10년 전 조회 1,474
10년 전 조회 1,377
10년 전 조회 2,108
10년 전 조회 1,639
10년 전 조회 1,387
10년 전 조회 1,478
10년 전 조회 1,716
10년 전 조회 1,394
10년 전 조회 1,583
10년 전 조회 1,409
10년 전 조회 1,530
10년 전 조회 1,373
10년 전 조회 1,335
10년 전 조회 1,340
10년 전 조회 1,374
10년 전 조회 1,371
10년 전 조회 1,402
10년 전 조회 1,430
10년 전 조회 1,401
10년 전 조회 1,558
10년 전 조회 1,543
10년 전 조회 1,335
10년 전 조회 1,636
10년 전 조회 1,986
10년 전 조회 1,435
10년 전 조회 1,686
10년 전 조회 1,649
10년 전 조회 1,505
10년 전 조회 1,452
10년 전 조회 1,423
10년 전 조회 1,532
10년 전 조회 1,269
10년 전 조회 1,359
10년 전 조회 1,581
10년 전 조회 1,398
10년 전 조회 1,394
10년 전 조회 1,342
10년 전 조회 1,387
10년 전 조회 1,369
10년 전 조회 1,375
10년 전 조회 1,405
10년 전 조회 1,343
10년 전 조회 1,514
10년 전 조회 1,337
10년 전 조회 1,346
10년 전 조회 1,439
10년 전 조회 2,168
10년 전 조회 1,408
10년 전 조회 1,394
10년 전 조회 1,473
10년 전 조회 1,388
10년 전 조회 1,577
10년 전 조회 1,475
10년 전 조회 1,395
10년 전 조회 1,397
10년 전 조회 1,442
10년 전 조회 1,420
10년 전 조회 1,341
10년 전 조회 1,300
10년 전 조회 1,279
10년 전 조회 1,316
10년 전 조회 1,702
10년 전 조회 1,333
10년 전 조회 1,451