PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1264

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,274
10년 전 조회 1,227
10년 전 조회 1,259
10년 전 조회 1,368
10년 전 조회 1,236
10년 전 조회 1,207
10년 전 조회 1,215
10년 전 조회 1,316
10년 전 조회 1,210
10년 전 조회 1,165
10년 전 조회 1,190
10년 전 조회 1,195
10년 전 조회 1,248
10년 전 조회 1,169
10년 전 조회 1,401
10년 전 조회 1,557
10년 전 조회 1,455
10년 전 조회 1,214
10년 전 조회 1,219
10년 전 조회 1,171
10년 전 조회 1,172
10년 전 조회 1,285
10년 전 조회 1,215
10년 전 조회 1,156
10년 전 조회 1,211
10년 전 조회 1,564
10년 전 조회 2,014
10년 전 조회 1,600
10년 전 조회 1,418
10년 전 조회 1,382
10년 전 조회 1,222
10년 전 조회 1,212
10년 전 조회 1,236
10년 전 조회 1,199
10년 전 조회 1,212
10년 전 조회 1,238
10년 전 조회 1,396
10년 전 조회 1,312
10년 전 조회 2,040
10년 전 조회 1,568
10년 전 조회 1,310
10년 전 조회 1,398
10년 전 조회 1,649
10년 전 조회 1,337
10년 전 조회 1,513
10년 전 조회 1,351
10년 전 조회 1,457
10년 전 조회 1,304
10년 전 조회 1,274
10년 전 조회 1,265
10년 전 조회 1,297
10년 전 조회 1,297
10년 전 조회 1,327
10년 전 조회 1,355
10년 전 조회 1,327
10년 전 조회 1,482
10년 전 조회 1,479
10년 전 조회 1,259
10년 전 조회 1,566
10년 전 조회 1,920
10년 전 조회 1,354
10년 전 조회 1,615
10년 전 조회 1,577
10년 전 조회 1,422
10년 전 조회 1,392
10년 전 조회 1,348
10년 전 조회 1,462
10년 전 조회 1,202
10년 전 조회 1,281
10년 전 조회 1,495
10년 전 조회 1,324
10년 전 조회 1,320
10년 전 조회 1,277
10년 전 조회 1,302
10년 전 조회 1,285
10년 전 조회 1,288
10년 전 조회 1,310
10년 전 조회 1,262
10년 전 조회 1,435
10년 전 조회 1,263
10년 전 조회 1,268
10년 전 조회 1,339
10년 전 조회 2,085
10년 전 조회 1,312
10년 전 조회 1,310
10년 전 조회 1,398
10년 전 조회 1,309
10년 전 조회 1,469
10년 전 조회 1,387
10년 전 조회 1,309
10년 전 조회 1,311
10년 전 조회 1,363
10년 전 조회 1,338
10년 전 조회 1,257
10년 전 조회 1,215
10년 전 조회 1,184
10년 전 조회 1,221
10년 전 조회 1,607
10년 전 조회 1,261
10년 전 조회 1,364