PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1351

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,347
10년 전 조회 1,305
10년 전 조회 1,325
10년 전 조회 1,451
10년 전 조회 1,317
10년 전 조회 1,278
10년 전 조회 1,289
10년 전 조회 1,409
10년 전 조회 1,286
10년 전 조회 1,244
10년 전 조회 1,273
10년 전 조회 1,284
10년 전 조회 1,333
10년 전 조회 1,262
10년 전 조회 1,491
10년 전 조회 1,627
10년 전 조회 1,532
10년 전 조회 1,299
10년 전 조회 1,291
10년 전 조회 1,257
10년 전 조회 1,248
10년 전 조회 1,374
10년 전 조회 1,289
10년 전 조회 1,240
10년 전 조회 1,290
10년 전 조회 1,638
10년 전 조회 2,109
10년 전 조회 1,679
10년 전 조회 1,506
10년 전 조회 1,473
10년 전 조회 1,323
10년 전 조회 1,305
10년 전 조회 1,327
10년 전 조회 1,280
10년 전 조회 1,297
10년 전 조회 1,322
10년 전 조회 1,487
10년 전 조회 1,384
10년 전 조회 2,116
10년 전 조회 1,647
10년 전 조회 1,398
10년 전 조회 1,488
10년 전 조회 1,722
10년 전 조회 1,401
10년 전 조회 1,587
10년 전 조회 1,415
10년 전 조회 1,543
10년 전 조회 1,380
10년 전 조회 1,343
10년 전 조회 1,352
10년 전 조회 1,383
10년 전 조회 1,376
10년 전 조회 1,410
10년 전 조회 1,440
10년 전 조회 1,410
10년 전 조회 1,564
10년 전 조회 1,552
10년 전 조회 1,345
10년 전 조회 1,651
10년 전 조회 1,996
10년 전 조회 1,451
10년 전 조회 1,697
10년 전 조회 1,660
10년 전 조회 1,519
10년 전 조회 1,467
10년 전 조회 1,433
10년 전 조회 1,542
10년 전 조회 1,276
10년 전 조회 1,368
10년 전 조회 1,590
10년 전 조회 1,410
10년 전 조회 1,403
10년 전 조회 1,353
10년 전 조회 1,393
10년 전 조회 1,378
10년 전 조회 1,383
10년 전 조회 1,410
10년 전 조회 1,361
10년 전 조회 1,523
10년 전 조회 1,344
10년 전 조회 1,360
10년 전 조회 1,456
10년 전 조회 2,180
10년 전 조회 1,418
10년 전 조회 1,403
10년 전 조회 1,479
10년 전 조회 1,396
10년 전 조회 1,590
10년 전 조회 1,485
10년 전 조회 1,404
10년 전 조회 1,411
10년 전 조회 1,451
10년 전 조회 1,429
10년 전 조회 1,353
10년 전 조회 1,310
10년 전 조회 1,287
10년 전 조회 1,324
10년 전 조회 1,715
10년 전 조회 1,347
10년 전 조회 1,460