PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1354

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,244
10년 전 조회 1,355
10년 전 조회 1,313
10년 전 조회 1,332
10년 전 조회 1,460
10년 전 조회 1,320
10년 전 조회 1,281
10년 전 조회 1,294
10년 전 조회 1,415
10년 전 조회 1,290
10년 전 조회 1,247
10년 전 조회 1,281
10년 전 조회 1,288
10년 전 조회 1,339
10년 전 조회 1,267
10년 전 조회 1,496
10년 전 조회 1,633
10년 전 조회 1,541
10년 전 조회 1,304
10년 전 조회 1,295
10년 전 조회 1,262
10년 전 조회 1,252
10년 전 조회 1,380
10년 전 조회 1,291
10년 전 조회 1,247
10년 전 조회 1,297
10년 전 조회 1,640
10년 전 조회 2,115
10년 전 조회 1,683
10년 전 조회 1,478
10년 전 조회 1,331
10년 전 조회 1,311
10년 전 조회 1,333
10년 전 조회 1,285
10년 전 조회 1,306
10년 전 조회 1,330
10년 전 조회 1,491
10년 전 조회 1,390
10년 전 조회 2,124
10년 전 조회 1,655
10년 전 조회 1,402
10년 전 조회 1,494
10년 전 조회 1,728
10년 전 조회 1,405
10년 전 조회 1,594
10년 전 조회 1,425
10년 전 조회 1,548
10년 전 조회 1,384
10년 전 조회 1,345
10년 전 조회 1,355
10년 전 조회 1,389
10년 전 조회 1,381
10년 전 조회 1,414
10년 전 조회 1,450
10년 전 조회 1,416
10년 전 조회 1,572
10년 전 조회 1,556
10년 전 조회 1,348
10년 전 조회 1,659
10년 전 조회 2,000
10년 전 조회 1,458
10년 전 조회 1,703
10년 전 조회 1,665
10년 전 조회 1,526
10년 전 조회 1,474
10년 전 조회 1,437
10년 전 조회 1,547
10년 전 조회 1,282
10년 전 조회 1,375
10년 전 조회 1,595
10년 전 조회 1,418
10년 전 조회 1,406
10년 전 조회 1,359
10년 전 조회 1,398
10년 전 조회 1,383
10년 전 조회 1,388
10년 전 조회 1,418
10년 전 조회 1,369
10년 전 조회 1,531
10년 전 조회 1,354
10년 전 조회 1,366
10년 전 조회 1,467
10년 전 조회 2,191
10년 전 조회 1,423
10년 전 조회 1,410
10년 전 조회 1,488
10년 전 조회 1,400
10년 전 조회 1,597
10년 전 조회 1,489
10년 전 조회 1,409
10년 전 조회 1,415
10년 전 조회 1,453
10년 전 조회 1,436
10년 전 조회 1,359
10년 전 조회 1,318
10년 전 조회 1,295
10년 전 조회 1,330
10년 전 조회 1,729
10년 전 조회 1,352
10년 전 조회 1,463