PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1385

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,270
10년 전 조회 1,380
10년 전 조회 1,346
10년 전 조회 1,372
10년 전 조회 1,504
10년 전 조회 1,349
10년 전 조회 1,326
10년 전 조회 1,329
10년 전 조회 1,439
10년 전 조회 1,323
10년 전 조회 1,284
10년 전 조회 1,320
10년 전 조회 1,329
10년 전 조회 1,380
10년 전 조회 1,301
10년 전 조회 1,523
10년 전 조회 1,673
10년 전 조회 1,584
10년 전 조회 1,338
10년 전 조회 1,332
10년 전 조회 1,303
10년 전 조회 1,285
10년 전 조회 1,404
10년 전 조회 1,320
10년 전 조회 1,282
10년 전 조회 1,332
10년 전 조회 1,673
10년 전 조회 2,146
10년 전 조회 1,715
10년 전 조회 1,515
10년 전 조회 1,375
10년 전 조회 1,341
10년 전 조회 1,367
10년 전 조회 1,321
10년 전 조회 1,346
10년 전 조회 1,363
10년 전 조회 1,532
10년 전 조회 1,418
10년 전 조회 2,158
10년 전 조회 1,699
10년 전 조회 1,441
10년 전 조회 1,525
10년 전 조회 1,761
10년 전 조회 1,442
10년 전 조회 1,627
10년 전 조회 1,462
10년 전 조회 1,575
10년 전 조회 1,421
10년 전 조회 1,379
10년 전 조회 1,386
10년 전 조회 1,426
10년 전 조회 1,424
10년 전 조회 1,454
10년 전 조회 1,490
10년 전 조회 1,454
10년 전 조회 1,610
10년 전 조회 1,590
10년 전 조회 1,389
10년 전 조회 1,700
10년 전 조회 2,032
10년 전 조회 1,495
10년 전 조회 1,735
10년 전 조회 1,699
10년 전 조회 1,551
10년 전 조회 1,516
10년 전 조회 1,485
10년 전 조회 1,584
10년 전 조회 1,326
10년 전 조회 1,409
10년 전 조회 1,625
10년 전 조회 1,455
10년 전 조회 1,434
10년 전 조회 1,403
10년 전 조회 1,428
10년 전 조회 1,435
10년 전 조회 1,427
10년 전 조회 1,459
10년 전 조회 1,403
10년 전 조회 1,571
10년 전 조회 1,403
10년 전 조회 1,403
10년 전 조회 1,509
10년 전 조회 2,226
10년 전 조회 1,471
10년 전 조회 1,440
10년 전 조회 1,529
10년 전 조회 1,443
10년 전 조회 1,631
10년 전 조회 1,527
10년 전 조회 1,448
10년 전 조회 1,451
10년 전 조회 1,476
10년 전 조회 1,462
10년 전 조회 1,398
10년 전 조회 1,358
10년 전 조회 1,339
10년 전 조회 1,372
10년 전 조회 1,766
10년 전 조회 1,394
10년 전 조회 1,495