PHP ANOTATION , Reflection 입니다.

· 10년 전 · 1427

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,302
10년 전 조회 1,417
10년 전 조회 1,386
10년 전 조회 1,410
10년 전 조회 1,548
10년 전 조회 1,387
10년 전 조회 1,377
10년 전 조회 1,378
10년 전 조회 1,479
10년 전 조회 1,374
10년 전 조회 1,330
10년 전 조회 1,349
10년 전 조회 1,362
10년 전 조회 1,422
10년 전 조회 1,347
10년 전 조회 1,560
10년 전 조회 1,714
10년 전 조회 1,628
10년 전 조회 1,384
10년 전 조회 1,384
10년 전 조회 1,342
10년 전 조회 1,326
10년 전 조회 1,444
10년 전 조회 1,355
10년 전 조회 1,317
10년 전 조회 1,380
10년 전 조회 1,718
10년 전 조회 2,191
10년 전 조회 1,756
10년 전 조회 1,557
10년 전 조회 1,422
10년 전 조회 1,394
10년 전 조회 1,413
10년 전 조회 1,371
10년 전 조회 1,394
10년 전 조회 1,405
10년 전 조회 1,577
10년 전 조회 1,462
10년 전 조회 2,195
10년 전 조회 1,750
10년 전 조회 1,479
10년 전 조회 1,576
10년 전 조회 1,805
10년 전 조회 1,482
10년 전 조회 1,682
10년 전 조회 1,515
10년 전 조회 1,627
10년 전 조회 1,467
10년 전 조회 1,432
10년 전 조회 1,428
10년 전 조회 1,473
10년 전 조회 1,468
10년 전 조회 1,504
10년 전 조회 1,530
10년 전 조회 1,497
10년 전 조회 1,644
10년 전 조회 1,635
10년 전 조회 1,438
10년 전 조회 1,749
10년 전 조회 2,074
10년 전 조회 1,536
10년 전 조회 1,784
10년 전 조회 1,753
10년 전 조회 1,593
10년 전 조회 1,579
10년 전 조회 1,525
10년 전 조회 1,628
10년 전 조회 1,376
10년 전 조회 1,451
10년 전 조회 1,667
10년 전 조회 1,493
10년 전 조회 1,463
10년 전 조회 1,442
10년 전 조회 1,464
10년 전 조회 1,480
10년 전 조회 1,474
10년 전 조회 1,494
10년 전 조회 1,446
10년 전 조회 1,615
10년 전 조회 1,442
10년 전 조회 1,452
10년 전 조회 1,561
10년 전 조회 2,270
10년 전 조회 1,514
10년 전 조회 1,486
10년 전 조회 1,571
10년 전 조회 1,484
10년 전 조회 1,663
10년 전 조회 1,572
10년 전 조회 1,488
10년 전 조회 1,485
10년 전 조회 1,516
10년 전 조회 1,509
10년 전 조회 1,442
10년 전 조회 1,395
10년 전 조회 1,377
10년 전 조회 1,417
10년 전 조회 1,817
10년 전 조회 1,440
10년 전 조회 1,542