PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1257

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,268
10년 전 조회 1,215
10년 전 조회 1,252
10년 전 조회 1,361
10년 전 조회 1,228
10년 전 조회 1,195
10년 전 조회 1,207
10년 전 조회 1,305
10년 전 조회 1,202
10년 전 조회 1,161
10년 전 조회 1,184
10년 전 조회 1,190
10년 전 조회 1,242
10년 전 조회 1,168
10년 전 조회 1,389
10년 전 조회 1,548
10년 전 조회 1,447
10년 전 조회 1,208
10년 전 조회 1,210
10년 전 조회 1,162
10년 전 조회 1,168
10년 전 조회 1,281
10년 전 조회 1,212
10년 전 조회 1,150
10년 전 조회 1,206
10년 전 조회 1,555
10년 전 조회 2,006
10년 전 조회 1,594
10년 전 조회 1,415
10년 전 조회 1,377
10년 전 조회 1,215
10년 전 조회 1,208
10년 전 조회 1,230
10년 전 조회 1,191
10년 전 조회 1,207
10년 전 조회 1,228
10년 전 조회 1,390
10년 전 조회 1,307
10년 전 조회 2,028
10년 전 조회 1,565
10년 전 조회 1,300
10년 전 조회 1,390
10년 전 조회 1,646
10년 전 조회 1,327
10년 전 조회 1,505
10년 전 조회 1,346
10년 전 조회 1,449
10년 전 조회 1,300
10년 전 조회 1,269
10년 전 조회 1,258
10년 전 조회 1,295
10년 전 조회 1,289
10년 전 조회 1,318
10년 전 조회 1,351
10년 전 조회 1,314
10년 전 조회 1,478
10년 전 조회 1,467
10년 전 조회 1,250
10년 전 조회 1,556
10년 전 조회 1,913
10년 전 조회 1,351
10년 전 조회 1,608
10년 전 조회 1,568
10년 전 조회 1,418
10년 전 조회 1,383
10년 전 조회 1,335
10년 전 조회 1,454
10년 전 조회 1,191
10년 전 조회 1,275
10년 전 조회 1,486
10년 전 조회 1,308
10년 전 조회 1,306
10년 전 조회 1,267
10년 전 조회 1,295
10년 전 조회 1,277
10년 전 조회 1,274
10년 전 조회 1,301
10년 전 조회 1,259
10년 전 조회 1,429
10년 전 조회 1,250
10년 전 조회 1,259
10년 전 조회 1,333
10년 전 조회 2,080
10년 전 조회 1,305
10년 전 조회 1,300
10년 전 조회 1,389
10년 전 조회 1,300
10년 전 조회 1,457
10년 전 조회 1,380
10년 전 조회 1,298
10년 전 조회 1,305
10년 전 조회 1,356
10년 전 조회 1,329
10년 전 조회 1,250
10년 전 조회 1,205
10년 전 조회 1,178
10년 전 조회 1,212
10년 전 조회 1,597
10년 전 조회 1,254
10년 전 조회 1,353