PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1272

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,280
10년 전 조회 1,232
10년 전 조회 1,265
10년 전 조회 1,374
10년 전 조회 1,246
10년 전 조회 1,210
10년 전 조회 1,217
10년 전 조회 1,320
10년 전 조회 1,221
10년 전 조회 1,167
10년 전 조회 1,194
10년 전 조회 1,202
10년 전 조회 1,251
10년 전 조회 1,179
10년 전 조회 1,408
10년 전 조회 1,561
10년 전 조회 1,464
10년 전 조회 1,215
10년 전 조회 1,223
10년 전 조회 1,176
10년 전 조회 1,177
10년 전 조회 1,290
10년 전 조회 1,221
10년 전 조회 1,162
10년 전 조회 1,221
10년 전 조회 1,574
10년 전 조회 2,022
10년 전 조회 1,607
10년 전 조회 1,424
10년 전 조회 1,385
10년 전 조회 1,229
10년 전 조회 1,224
10년 전 조회 1,242
10년 전 조회 1,206
10년 전 조회 1,216
10년 전 조회 1,247
10년 전 조회 1,403
10년 전 조회 1,317
10년 전 조회 2,047
10년 전 조회 1,577
10년 전 조회 1,320
10년 전 조회 1,403
10년 전 조회 1,658
10년 전 조회 1,342
10년 전 조회 1,516
10년 전 조회 1,351
10년 전 조회 1,462
10년 전 조회 1,306
10년 전 조회 1,280
10년 전 조회 1,273
10년 전 조회 1,306
10년 전 조회 1,305
10년 전 조회 1,335
10년 전 조회 1,361
10년 전 조회 1,334
10년 전 조회 1,488
10년 전 조회 1,485
10년 전 조회 1,269
10년 전 조회 1,574
10년 전 조회 1,927
10년 전 조회 1,362
10년 전 조회 1,620
10년 전 조회 1,582
10년 전 조회 1,430
10년 전 조회 1,398
10년 전 조회 1,353
10년 전 조회 1,469
10년 전 조회 1,211
10년 전 조회 1,287
10년 전 조회 1,500
10년 전 조회 1,328
10년 전 조회 1,327
10년 전 조회 1,284
10년 전 조회 1,308
10년 전 조회 1,298
10년 전 조회 1,295
10년 전 조회 1,317
10년 전 조회 1,268
10년 전 조회 1,440
10년 전 조회 1,270
10년 전 조회 1,275
10년 전 조회 1,347
10년 전 조회 2,097
10년 전 조회 1,322
10년 전 조회 1,313
10년 전 조회 1,411
10년 전 조회 1,316
10년 전 조회 1,479
10년 전 조회 1,395
10년 전 조회 1,319
10년 전 조회 1,317
10년 전 조회 1,372
10년 전 조회 1,345
10년 전 조회 1,261
10년 전 조회 1,222
10년 전 조회 1,191
10년 전 조회 1,227
10년 전 조회 1,614
10년 전 조회 1,266
10년 전 조회 1,369