PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1270

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,280
10년 전 조회 1,230
10년 전 조회 1,262
10년 전 조회 1,373
10년 전 조회 1,245
10년 전 조회 1,210
10년 전 조회 1,216
10년 전 조회 1,320
10년 전 조회 1,216
10년 전 조회 1,167
10년 전 조회 1,194
10년 전 조회 1,202
10년 전 조회 1,250
10년 전 조회 1,176
10년 전 조회 1,407
10년 전 조회 1,561
10년 전 조회 1,462
10년 전 조회 1,215
10년 전 조회 1,222
10년 전 조회 1,174
10년 전 조회 1,175
10년 전 조회 1,287
10년 전 조회 1,219
10년 전 조회 1,161
10년 전 조회 1,220
10년 전 조회 1,571
10년 전 조회 2,020
10년 전 조회 1,603
10년 전 조회 1,422
10년 전 조회 1,383
10년 전 조회 1,228
10년 전 조회 1,218
10년 전 조회 1,240
10년 전 조회 1,205
10년 전 조회 1,214
10년 전 조회 1,245
10년 전 조회 1,401
10년 전 조회 1,317
10년 전 조회 2,045
10년 전 조회 1,575
10년 전 조회 1,318
10년 전 조회 1,402
10년 전 조회 1,653
10년 전 조회 1,340
10년 전 조회 1,514
10년 전 조회 1,351
10년 전 조회 1,460
10년 전 조회 1,306
10년 전 조회 1,276
10년 전 조회 1,271
10년 전 조회 1,304
10년 전 조회 1,303
10년 전 조회 1,330
10년 전 조회 1,361
10년 전 조회 1,334
10년 전 조회 1,485
10년 전 조회 1,484
10년 전 조회 1,265
10년 전 조회 1,574
10년 전 조회 1,924
10년 전 조회 1,359
10년 전 조회 1,618
10년 전 조회 1,579
10년 전 조회 1,429
10년 전 조회 1,397
10년 전 조회 1,350
10년 전 조회 1,467
10년 전 조회 1,209
10년 전 조회 1,286
10년 전 조회 1,500
10년 전 조회 1,327
10년 전 조회 1,324
10년 전 조회 1,282
10년 전 조회 1,307
10년 전 조회 1,294
10년 전 조회 1,295
10년 전 조회 1,317
10년 전 조회 1,266
10년 전 조회 1,439
10년 전 조회 1,270
10년 전 조회 1,274
10년 전 조회 1,347
10년 전 조회 2,096
10년 전 조회 1,318
10년 전 조회 1,312
10년 전 조회 1,408
10년 전 조회 1,315
10년 전 조회 1,476
10년 전 조회 1,393
10년 전 조회 1,316
10년 전 조회 1,314
10년 전 조회 1,371
10년 전 조회 1,344
10년 전 조회 1,260
10년 전 조회 1,217
10년 전 조회 1,189
10년 전 조회 1,226
10년 전 조회 1,613
10년 전 조회 1,264
10년 전 조회 1,368