COMING SOON 🚀

PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1284

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,292
10년 전 조회 1,249
10년 전 조회 1,275
10년 전 조회 1,388
10년 전 조회 1,261
10년 전 조회 1,222
10년 전 조회 1,226
10년 전 조회 1,333
10년 전 조회 1,229
10년 전 조회 1,190
10년 전 조회 1,205
10년 전 조회 1,219
10년 전 조회 1,277
10년 전 조회 1,190
10년 전 조회 1,424
10년 전 조회 1,578
10년 전 조회 1,482
10년 전 조회 1,232
10년 전 조회 1,239
10년 전 조회 1,190
10년 전 조회 1,187
10년 전 조회 1,305
10년 전 조회 1,234
10년 전 조회 1,175
10년 전 조회 1,235
10년 전 조회 1,587
10년 전 조회 2,045
10년 전 조회 1,623
10년 전 조회 1,442
10년 전 조회 1,402
10년 전 조회 1,248
10년 전 조회 1,242
10년 전 조회 1,261
10년 전 조회 1,223
10년 전 조회 1,232
10년 전 조회 1,263
10년 전 조회 1,422
10년 전 조회 1,332
10년 전 조회 2,055
10년 전 조회 1,591
10년 전 조회 1,335
10년 전 조회 1,422
10년 전 조회 1,681
10년 전 조회 1,353
10년 전 조회 1,535
10년 전 조회 1,369
10년 전 조회 1,482
10년 전 조회 1,322
10년 전 조회 1,294
10년 전 조회 1,285
10년 전 조회 1,315
10년 전 조회 1,321
10년 전 조회 1,351
10년 전 조회 1,376
10년 전 조회 1,356
10년 전 조회 1,509
10년 전 조회 1,499
10년 전 조회 1,283
10년 전 조회 1,582
10년 전 조회 1,943
10년 전 조회 1,369
10년 전 조회 1,641
10년 전 조회 1,596
10년 전 조회 1,447
10년 전 조회 1,409
10년 전 조회 1,368
10년 전 조회 1,489
10년 전 조회 1,228
10년 전 조회 1,300
10년 전 조회 1,524
10년 전 조회 1,352
10년 전 조회 1,341
10년 전 조회 1,306
10년 전 조회 1,325
10년 전 조회 1,317
10년 전 조회 1,318
10년 전 조회 1,338
10년 전 조회 1,280
10년 전 조회 1,455
10년 전 조회 1,283
10년 전 조회 1,287
10년 전 조회 1,370
10년 전 조회 2,111
10년 전 조회 1,340
10년 전 조회 1,332
10년 전 조회 1,426
10년 전 조회 1,325
10년 전 조회 1,497
10년 전 조회 1,407
10년 전 조회 1,341
10년 전 조회 1,339
10년 전 조회 1,383
10년 전 조회 1,365
10년 전 조회 1,276
10년 전 조회 1,243
10년 전 조회 1,206
10년 전 조회 1,247
10년 전 조회 1,630
10년 전 조회 1,279
10년 전 조회 1,393