COMING SOON 🚀

PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1301

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,304
10년 전 조회 1,263
10년 전 조회 1,284
10년 전 조회 1,402
10년 전 조회 1,271
10년 전 조회 1,227
10년 전 조회 1,236
10년 전 조회 1,349
10년 전 조회 1,240
10년 전 조회 1,202
10년 전 조회 1,216
10년 전 조회 1,228
10년 전 조회 1,287
10년 전 조회 1,202
10년 전 조회 1,436
10년 전 조회 1,592
10년 전 조회 1,494
10년 전 조회 1,245
10년 전 조회 1,250
10년 전 조회 1,207
10년 전 조회 1,202
10년 전 조회 1,319
10년 전 조회 1,244
10년 전 조회 1,185
10년 전 조회 1,248
10년 전 조회 1,596
10년 전 조회 2,057
10년 전 조회 1,632
10년 전 조회 1,460
10년 전 조회 1,419
10년 전 조회 1,268
10년 전 조회 1,260
10년 전 조회 1,273
10년 전 조회 1,236
10년 전 조회 1,246
10년 전 조회 1,277
10년 전 조회 1,434
10년 전 조회 1,346
10년 전 조회 2,065
10년 전 조회 1,601
10년 전 조회 1,350
10년 전 조회 1,440
10년 전 조회 1,697
10년 전 조회 1,365
10년 전 조회 1,543
10년 전 조회 1,385
10년 전 조회 1,493
10년 전 조회 1,337
10년 전 조회 1,303
10년 전 조회 1,302
10년 전 조회 1,332
10년 전 조회 1,340
10년 전 조회 1,368
10년 전 조회 1,397
10년 전 조회 1,365
10년 전 조회 1,521
10년 전 조회 1,513
10년 전 조회 1,296
10년 전 조회 1,593
10년 전 조회 1,953
10년 전 조회 1,390
10년 전 조회 1,654
10년 전 조회 1,615
10년 전 조회 1,469
10년 전 조회 1,417
10년 전 조회 1,382
10년 전 조회 1,504
10년 전 조회 1,241
10년 전 조회 1,316
10년 전 조회 1,541
10년 전 조회 1,361
10년 전 조회 1,354
10년 전 조회 1,313
10년 전 조회 1,342
10년 전 조회 1,331
10년 전 조회 1,336
10년 전 조회 1,357
10년 전 조회 1,294
10년 전 조회 1,470
10년 전 조회 1,294
10년 전 조회 1,297
10년 전 조회 1,390
10년 전 조회 2,125
10년 전 조회 1,362
10년 전 조회 1,347
10년 전 조회 1,440
10년 전 조회 1,344
10년 전 조회 1,524
10년 전 조회 1,427
10년 전 조회 1,354
10년 전 조회 1,351
10년 전 조회 1,393
10년 전 조회 1,377
10년 전 조회 1,291
10년 전 조회 1,262
10년 전 조회 1,228
10년 전 조회 1,261
10년 전 조회 1,653
10년 전 조회 1,295
10년 전 조회 1,408