コード例 #1
0
ファイル: annotation_test.php プロジェクト: jaz303/phpx
 public function test_annotations()
 {
     parse_and_eval(dirname(__FILE__) . '/annotation_test_class.phpx');
     assert_equal(array('model' => true), phpx\annotations_for('ExamplesAnnotationTestClass'));
     assert_equal(array('model' => true), phpx\annotations_for(new ExamplesAnnotationTestClass()));
     assert_equal(array('foo' => 'bar'), phpx\annotations_for('ExamplesAnnotationTestClass', '$baz'));
     assert_equal(array('foo' => 'bar'), phpx\annotations_for(new ExamplesAnnotationTestClass(), '$baz'));
     assert_equal(array('access' => array('admin', 'public')), phpx\annotations_for('ExamplesAnnotationTestClass', 'find_all'));
     assert_equal(array('access' => array('admin', 'public')), phpx\annotations_for(new ExamplesAnnotationTestClass(), 'find_all'));
 }
コード例 #2
0
ファイル: SimpleORM.php プロジェクト: jaz303/phpx
 public static function table_name()
 {
     // get_called_class() will return the name of the class into which we are mixed
     $annotes = \phpx\annotations_for(get_called_class());
     return $annotes['table_name'];
 }