PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1366

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,256
10년 전 조회 1,367
10년 전 조회 1,327
10년 전 조회 1,350
10년 전 조회 1,482
10년 전 조회 1,330
10년 전 조회 1,299
10년 전 조회 1,310
10년 전 조회 1,428
10년 전 조회 1,300
10년 전 조회 1,267
10년 전 조회 1,299
10년 전 조회 1,310
10년 전 조회 1,359
10년 전 조회 1,281
10년 전 조회 1,510
10년 전 조회 1,645
10년 전 조회 1,563
10년 전 조회 1,321
10년 전 조회 1,310
10년 전 조회 1,277
10년 전 조회 1,267
10년 전 조회 1,389
10년 전 조회 1,306
10년 전 조회 1,263
10년 전 조회 1,312
10년 전 조회 1,652
10년 전 조회 2,134
10년 전 조회 1,698
10년 전 조회 1,497
10년 전 조회 1,358
10년 전 조회 1,322
10년 전 조회 1,344
10년 전 조회 1,300
10년 전 조회 1,323
10년 전 조회 1,347
10년 전 조회 1,511
10년 전 조회 1,406
10년 전 조회 2,142
10년 전 조회 1,671
10년 전 조회 1,415
10년 전 조회 1,511
10년 전 조회 1,742
10년 전 조회 1,424
10년 전 조회 1,609
10년 전 조회 1,438
10년 전 조회 1,557
10년 전 조회 1,399
10년 전 조회 1,356
10년 전 조회 1,367
10년 전 조회 1,414
10년 전 조회 1,399
10년 전 조회 1,427
10년 전 조회 1,468
10년 전 조회 1,436
10년 전 조회 1,583
10년 전 조회 1,571
10년 전 조회 1,367
10년 전 조회 1,676
10년 전 조회 2,015
10년 전 조회 1,471
10년 전 조회 1,715
10년 전 조회 1,676
10년 전 조회 1,538
10년 전 조회 1,494
10년 전 조회 1,458
10년 전 조회 1,563
10년 전 조회 1,306
10년 전 조회 1,388
10년 전 조회 1,610
10년 전 조회 1,439
10년 전 조회 1,421
10년 전 조회 1,376
10년 전 조회 1,413
10년 전 조회 1,406
10년 전 조회 1,410
10년 전 조회 1,435
10년 전 조회 1,385
10년 전 조회 1,551
10년 전 조회 1,372
10년 전 조회 1,381
10년 전 조회 1,482
10년 전 조회 2,206
10년 전 조회 1,446
10년 전 조회 1,423
10년 전 조회 1,508
10년 전 조회 1,421
10년 전 조회 1,613
10년 전 조회 1,508
10년 전 조회 1,431
10년 전 조회 1,434
10년 전 조회 1,462
10년 전 조회 1,448
10년 전 조회 1,379
10년 전 조회 1,340
10년 전 조회 1,317
10년 전 조회 1,357
10년 전 조회 1,745
10년 전 조회 1,375
10년 전 조회 1,478