PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1360

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,251
10년 전 조회 1,362
10년 전 조회 1,325
10년 전 조회 1,343
10년 전 조회 1,473
10년 전 조회 1,328
10년 전 조회 1,295
10년 전 조회 1,304
10년 전 조회 1,426
10년 전 조회 1,297
10년 전 조회 1,260
10년 전 조회 1,292
10년 전 조회 1,305
10년 전 조회 1,350
10년 전 조회 1,276
10년 전 조회 1,508
10년 전 조회 1,641
10년 전 조회 1,557
10년 전 조회 1,316
10년 전 조회 1,305
10년 전 조회 1,272
10년 전 조회 1,263
10년 전 조회 1,388
10년 전 조회 1,302
10년 전 조회 1,258
10년 전 조회 1,309
10년 전 조회 1,650
10년 전 조회 2,130
10년 전 조회 1,693
10년 전 조회 1,489
10년 전 조회 1,349
10년 전 조회 1,318
10년 전 조회 1,341
10년 전 조회 1,296
10년 전 조회 1,315
10년 전 조회 1,339
10년 전 조회 1,504
10년 전 조회 1,402
10년 전 조회 2,138
10년 전 조회 1,664
10년 전 조회 1,411
10년 전 조회 1,506
10년 전 조회 1,737
10년 전 조회 1,420
10년 전 조회 1,605
10년 전 조회 1,433
10년 전 조회 1,553
10년 전 조회 1,394
10년 전 조회 1,353
10년 전 조회 1,361
10년 전 조회 1,402
10년 전 조회 1,393
10년 전 조회 1,420
10년 전 조회 1,461
10년 전 조회 1,428
10년 전 조회 1,579
10년 전 조회 1,569
10년 전 조회 1,361
10년 전 조회 1,670
10년 전 조회 2,010
10년 전 조회 1,466
10년 전 조회 1,708
10년 전 조회 1,671
10년 전 조회 1,533
10년 전 조회 1,491
10년 전 조회 1,453
10년 전 조회 1,557
10년 전 조회 1,297
10년 전 조회 1,384
10년 전 조회 1,604
10년 전 조회 1,431
10년 전 조회 1,416
10년 전 조회 1,373
10년 전 조회 1,408
10년 전 조회 1,400
10년 전 조회 1,402
10년 전 조회 1,429
10년 전 조회 1,383
10년 전 조회 1,546
10년 전 조회 1,366
10년 전 조회 1,378
10년 전 조회 1,479
10년 전 조회 2,204
10년 전 조회 1,439
10년 전 조회 1,418
10년 전 조회 1,502
10년 전 조회 1,414
10년 전 조회 1,610
10년 전 조회 1,501
10년 전 조회 1,423
10년 전 조회 1,430
10년 전 조회 1,461
10년 전 조회 1,443
10년 전 조회 1,376
10년 전 조회 1,335
10년 전 조회 1,312
10년 전 조회 1,352
10년 전 조회 1,739
10년 전 조회 1,368
10년 전 조회 1,472