COMING SOON 🚀

PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1305

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,307
10년 전 조회 1,268
10년 전 조회 1,284
10년 전 조회 1,403
10년 전 조회 1,274
10년 전 조회 1,229
10년 전 조회 1,239
10년 전 조회 1,354
10년 전 조회 1,245
10년 전 조회 1,202
10년 전 조회 1,218
10년 전 조회 1,233
10년 전 조회 1,291
10년 전 조회 1,209
10년 전 조회 1,440
10년 전 조회 1,595
10년 전 조회 1,495
10년 전 조회 1,247
10년 전 조회 1,251
10년 전 조회 1,207
10년 전 조회 1,207
10년 전 조회 1,320
10년 전 조회 1,247
10년 전 조회 1,189
10년 전 조회 1,248
10년 전 조회 1,597
10년 전 조회 2,063
10년 전 조회 1,633
10년 전 조회 1,465
10년 전 조회 1,422
10년 전 조회 1,270
10년 전 조회 1,261
10년 전 조회 1,275
10년 전 조회 1,237
10년 전 조회 1,253
10년 전 조회 1,279
10년 전 조회 1,439
10년 전 조회 1,351
10년 전 조회 2,070
10년 전 조회 1,602
10년 전 조회 1,357
10년 전 조회 1,440
10년 전 조회 1,698
10년 전 조회 1,367
10년 전 조회 1,544
10년 전 조회 1,387
10년 전 조회 1,493
10년 전 조회 1,340
10년 전 조회 1,307
10년 전 조회 1,306
10년 전 조회 1,337
10년 전 조회 1,342
10년 전 조회 1,375
10년 전 조회 1,399
10년 전 조회 1,368
10년 전 조회 1,526
10년 전 조회 1,516
10년 전 조회 1,298
10년 전 조회 1,596
10년 전 조회 1,955
10년 전 조회 1,395
10년 전 조회 1,656
10년 전 조회 1,617
10년 전 조회 1,471
10년 전 조회 1,418
10년 전 조회 1,384
10년 전 조회 1,505
10년 전 조회 1,242
10년 전 조회 1,320
10년 전 조회 1,542
10년 전 조회 1,361
10년 전 조회 1,359
10년 전 조회 1,315
10년 전 조회 1,347
10년 전 조회 1,335
10년 전 조회 1,339
10년 전 조회 1,364
10년 전 조회 1,297
10년 전 조회 1,473
10년 전 조회 1,300
10년 전 조회 1,301
10년 전 조회 1,394
10년 전 조회 2,126
10년 전 조회 1,367
10년 전 조회 1,353
10년 전 조회 1,441
10년 전 조회 1,347
10년 전 조회 1,528
10년 전 조회 1,432
10년 전 조회 1,358
10년 전 조회 1,352
10년 전 조회 1,400
10년 전 조회 1,381
10년 전 조회 1,294
10년 전 조회 1,262
10년 전 조회 1,233
10년 전 조회 1,263
10년 전 조회 1,655
10년 전 조회 1,298
10년 전 조회 1,411