COMING SOON 🚀

PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1317

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,318
10년 전 조회 1,280
10년 전 조회 1,299
10년 전 조회 1,418
10년 전 조회 1,284
10년 전 조회 1,242
10년 전 조회 1,260
10년 전 조회 1,371
10년 전 조회 1,263
10년 전 조회 1,215
10년 전 조회 1,232
10년 전 조회 1,247
10년 전 조회 1,313
10년 전 조회 1,229
10년 전 조회 1,450
10년 전 조회 1,608
10년 전 조회 1,503
10년 전 조회 1,266
10년 전 조회 1,259
10년 전 조회 1,220
10년 전 조회 1,217
10년 전 조회 1,338
10년 전 조회 1,262
10년 전 조회 1,208
10년 전 조회 1,259
10년 전 조회 1,617
10년 전 조회 2,073
10년 전 조회 1,649
10년 전 조회 1,480
10년 전 조회 1,446
10년 전 조회 1,291
10년 전 조회 1,273
10년 전 조회 1,294
10년 전 조회 1,255
10년 전 조회 1,267
10년 전 조회 1,294
10년 전 조회 1,459
10년 전 조회 1,362
10년 전 조회 2,086
10년 전 조회 1,622
10년 전 조회 1,368
10년 전 조회 1,457
10년 전 조회 1,707
10년 전 조회 1,378
10년 전 조회 1,565
10년 전 조회 1,396
10년 전 조회 1,506
10년 전 조회 1,353
10년 전 조회 1,320
10년 전 조회 1,318
10년 전 조회 1,353
10년 전 조회 1,353
10년 전 조회 1,388
10년 전 조회 1,413
10년 전 조회 1,383
10년 전 조회 1,539
10년 전 조회 1,523
10년 전 조회 1,313
10년 전 조회 1,613
10년 전 조회 1,964
10년 전 조회 1,414
10년 전 조회 1,674
10년 전 조회 1,632
10년 전 조회 1,482
10년 전 조회 1,430
10년 전 조회 1,399
10년 전 조회 1,518
10년 전 조회 1,251
10년 전 조회 1,337
10년 전 조회 1,557
10년 전 조회 1,375
10년 전 조회 1,376
10년 전 조회 1,329
10년 전 조회 1,372
10년 전 조회 1,351
10년 전 조회 1,354
10년 전 조회 1,389
10년 전 조회 1,313
10년 전 조회 1,490
10년 전 조회 1,316
10년 전 조회 1,320
10년 전 조회 1,414
10년 전 조회 2,145
10년 전 조회 1,384
10년 전 조회 1,367
10년 전 조회 1,458
10년 전 조회 1,369
10년 전 조회 1,544
10년 전 조회 1,446
10년 전 조회 1,377
10년 전 조회 1,368
10년 전 조회 1,422
10년 전 조회 1,399
10년 전 조회 1,317
10년 전 조회 1,280
10년 전 조회 1,251
10년 전 조회 1,285
10년 전 조회 1,676
10년 전 조회 1,317
10년 전 조회 1,431