PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1349

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,343
10년 전 조회 1,304
10년 전 조회 1,323
10년 전 조회 1,448
10년 전 조회 1,311
10년 전 조회 1,273
10년 전 조회 1,285
10년 전 조회 1,404
10년 전 조회 1,285
10년 전 조회 1,239
10년 전 조회 1,270
10년 전 조회 1,279
10년 전 조회 1,328
10년 전 조회 1,258
10년 전 조회 1,486
10년 전 조회 1,626
10년 전 조회 1,529
10년 전 조회 1,294
10년 전 조회 1,286
10년 전 조회 1,251
10년 전 조회 1,244
10년 전 조회 1,369
10년 전 조회 1,286
10년 전 조회 1,235
10년 전 조회 1,286
10년 전 조회 1,635
10년 전 조회 2,107
10년 전 조회 1,673
10년 전 조회 1,503
10년 전 조회 1,472
10년 전 조회 1,316
10년 전 조회 1,300
10년 전 조회 1,322
10년 전 조회 1,279
10년 전 조회 1,293
10년 전 조회 1,319
10년 전 조회 1,483
10년 전 조회 1,381
10년 전 조회 2,113
10년 전 조회 1,646
10년 전 조회 1,394
10년 전 조회 1,482
10년 전 조회 1,718
10년 전 조회 1,400
10년 전 조회 1,585
10년 전 조회 1,411
10년 전 조회 1,535
10년 전 조회 1,376
10년 전 조회 1,339
10년 전 조회 1,350
10년 전 조회 1,382
10년 전 조회 1,375
10년 전 조회 1,407
10년 전 조회 1,437
10년 전 조회 1,405
10년 전 조회 1,561
10년 전 조회 1,549
10년 전 조회 1,339
10년 전 조회 1,647
10년 전 조회 1,990
10년 전 조회 1,444
10년 전 조회 1,695
10년 전 조회 1,658
10년 전 조회 1,516
10년 전 조회 1,462
10년 전 조회 1,431
10년 전 조회 1,538
10년 전 조회 1,271
10년 전 조회 1,364
10년 전 조회 1,589
10년 전 조회 1,406
10년 전 조회 1,400
10년 전 조회 1,348
10년 전 조회 1,391
10년 전 조회 1,373
10년 전 조회 1,381
10년 전 조회 1,409
10년 전 조회 1,354
10년 전 조회 1,518
10년 전 조회 1,341
10년 전 조회 1,357
10년 전 조회 1,448
10년 전 조회 2,174
10년 전 조회 1,416
10년 전 조회 1,399
10년 전 조회 1,474
10년 전 조회 1,391
10년 전 조회 1,586
10년 전 조회 1,482
10년 전 조회 1,402
10년 전 조회 1,403
10년 전 조회 1,449
10년 전 조회 1,426
10년 전 조회 1,348
10년 전 조회 1,307
10년 전 조회 1,284
10년 전 조회 1,318
10년 전 조회 1,708
10년 전 조회 1,338
10년 전 조회 1,456