PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1341

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,339
10년 전 조회 1,301
10년 전 조회 1,316
10년 전 조회 1,438
10년 전 조회 1,305
10년 전 조회 1,265
10년 전 조회 1,278
10년 전 조회 1,398
10년 전 조회 1,278
10년 전 조회 1,235
10년 전 조회 1,264
10년 전 조회 1,274
10년 전 조회 1,325
10년 전 조회 1,254
10년 전 조회 1,480
10년 전 조회 1,622
10년 전 조회 1,520
10년 전 조회 1,287
10년 전 조회 1,279
10년 전 조회 1,247
10년 전 조회 1,241
10년 전 조회 1,358
10년 전 조회 1,284
10년 전 조회 1,231
10년 전 조회 1,281
10년 전 조회 1,630
10년 전 조회 2,100
10년 전 조회 1,671
10년 전 조회 1,498
10년 전 조회 1,467
10년 전 조회 1,307
10년 전 조회 1,298
10년 전 조회 1,313
10년 전 조회 1,274
10년 전 조회 1,287
10년 전 조회 1,313
10년 전 조회 1,476
10년 전 조회 1,377
10년 전 조회 2,110
10년 전 조회 1,641
10년 전 조회 1,388
10년 전 조회 1,480
10년 전 조회 1,716
10년 전 조회 1,397
10년 전 조회 1,585
10년 전 조회 1,409
10년 전 조회 1,531
10년 전 조회 1,375
10년 전 조회 1,336
10년 전 조회 1,342
10년 전 조회 1,376
10년 전 조회 1,372
10년 전 조회 1,402
10년 전 조회 1,431
10년 전 조회 1,401
10년 전 조회 1,558
10년 전 조회 1,544
10년 전 조회 1,336
10년 전 조회 1,637
10년 전 조회 1,987
10년 전 조회 1,437
10년 전 조회 1,687
10년 전 조회 1,651
10년 전 조회 1,506
10년 전 조회 1,454
10년 전 조회 1,425
10년 전 조회 1,534
10년 전 조회 1,269
10년 전 조회 1,360
10년 전 조회 1,582
10년 전 조회 1,401
10년 전 조회 1,396
10년 전 조회 1,342
10년 전 조회 1,387
10년 전 조회 1,370
10년 전 조회 1,377
10년 전 조회 1,405
10년 전 조회 1,347
10년 전 조회 1,515
10년 전 조회 1,338
10년 전 조회 1,347
10년 전 조회 1,440
10년 전 조회 2,170
10년 전 조회 1,411
10년 전 조회 1,394
10년 전 조회 1,473
10년 전 조회 1,389
10년 전 조회 1,579
10년 전 조회 1,476
10년 전 조회 1,398
10년 전 조회 1,399
10년 전 조회 1,442
10년 전 조회 1,421
10년 전 조회 1,343
10년 전 조회 1,301
10년 전 조회 1,279
10년 전 조회 1,317
10년 전 조회 1,703
10년 전 조회 1,333
10년 전 조회 1,452