PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1255

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,268
10년 전 조회 1,215
10년 전 조회 1,251
10년 전 조회 1,360
10년 전 조회 1,227
10년 전 조회 1,195
10년 전 조회 1,205
10년 전 조회 1,305
10년 전 조회 1,201
10년 전 조회 1,160
10년 전 조회 1,183
10년 전 조회 1,190
10년 전 조회 1,241
10년 전 조회 1,167
10년 전 조회 1,387
10년 전 조회 1,547
10년 전 조회 1,446
10년 전 조회 1,208
10년 전 조회 1,210
10년 전 조회 1,162
10년 전 조회 1,168
10년 전 조회 1,281
10년 전 조회 1,212
10년 전 조회 1,150
10년 전 조회 1,206
10년 전 조회 1,553
10년 전 조회 2,006
10년 전 조회 1,593
10년 전 조회 1,415
10년 전 조회 1,375
10년 전 조회 1,214
10년 전 조회 1,207
10년 전 조회 1,229
10년 전 조회 1,189
10년 전 조회 1,206
10년 전 조회 1,228
10년 전 조회 1,390
10년 전 조회 1,307
10년 전 조회 2,027
10년 전 조회 1,565
10년 전 조회 1,300
10년 전 조회 1,390
10년 전 조회 1,646
10년 전 조회 1,326
10년 전 조회 1,504
10년 전 조회 1,345
10년 전 조회 1,449
10년 전 조회 1,299
10년 전 조회 1,269
10년 전 조회 1,256
10년 전 조회 1,294
10년 전 조회 1,286
10년 전 조회 1,316
10년 전 조회 1,351
10년 전 조회 1,314
10년 전 조회 1,477
10년 전 조회 1,467
10년 전 조회 1,250
10년 전 조회 1,556
10년 전 조회 1,913
10년 전 조회 1,350
10년 전 조회 1,605
10년 전 조회 1,568
10년 전 조회 1,418
10년 전 조회 1,382
10년 전 조회 1,335
10년 전 조회 1,454
10년 전 조회 1,190
10년 전 조회 1,275
10년 전 조회 1,485
10년 전 조회 1,306
10년 전 조회 1,306
10년 전 조회 1,267
10년 전 조회 1,295
10년 전 조회 1,276
10년 전 조회 1,272
10년 전 조회 1,300
10년 전 조회 1,259
10년 전 조회 1,429
10년 전 조회 1,250
10년 전 조회 1,259
10년 전 조회 1,333
10년 전 조회 2,079
10년 전 조회 1,305
10년 전 조회 1,299
10년 전 조회 1,389
10년 전 조회 1,300
10년 전 조회 1,457
10년 전 조회 1,379
10년 전 조회 1,297
10년 전 조회 1,303
10년 전 조회 1,354
10년 전 조회 1,327
10년 전 조회 1,249
10년 전 조회 1,204
10년 전 조회 1,178
10년 전 조회 1,212
10년 전 조회 1,596
10년 전 조회 1,254
10년 전 조회 1,352