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'
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 77 | 20년 전 | 2928 | ||
| 76 | 20년 전 | 6219 | ||
| 75 | 20년 전 | 4461 | ||
| 74 | 20년 전 | 5761 | ||
| 73 | 20년 전 | 3629 | ||
| 72 | 20년 전 | 5954 | ||
| 71 | 21년 전 | 3111 | ||
| 70 | 21년 전 | 2835 | ||
| 69 | 21년 전 | 2640 | ||
| 68 | 21년 전 | 2450 | ||
| 67 | 21년 전 | 2653 | ||
| 66 | 21년 전 | 2668 | ||
| 65 | 21년 전 | 3800 | ||
| 64 | 21년 전 | 2811 | ||
| 63 | 21년 전 | 2402 | ||
| 62 | 21년 전 | 2260 | ||
| 61 | 21년 전 | 3041 | ||
| 60 | 21년 전 | 3109 | ||
| 59 | 21년 전 | 2490 | ||
| 58 | 21년 전 | 2575 | ||
| 57 | 21년 전 | 2954 | ||
| 56 | 21년 전 | 2253 | ||
| 55 | 21년 전 | 2726 | ||
| 54 | 21년 전 | 2105 | ||
| 53 | 21년 전 | 2334 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기