freestyle-le

1、创建视图

 1 <?php
 2         class CategoryViewModel extends ViewModel{
 3             public $viewFields=array(
 4             //SELECT Category.id AS cid,Category.title AS ctitle,Category.alias AS calias,Category.published AS cpublished,
 5             //    Category.order AS corder,Category.access AS caccess,Category.sectionid AS sectionid,
 6             //        Section.title AS sec_Name 
 7             //            FROM joys_category Category JOIN joys_section Section 
 8             //                ON Category.sectionid=Section.id
 9                 \'Category\'=>array(\'id\'=>\'cid\',\'title\'=>\'ctitle\',\'alias\'=>\'calias\',\'published\'=>\'cpublished\',\'order\'=>\'corder\',\'access\'=>\'caccess\',\'sectionid\'),
10                 \'Section\'=>array(\'title\'=>\'sec_Name\',\'_on\'=>\'Category.sectionid=Section.id\'),
11             
12             );
13         }
14 ?>

2、测试

 1 <?php
 2         class CategoryAction extends CommonAction{
 3             public function index(){
 4                 $sec=new CategoryViewModel();
 5                 dump($sec->select());
 6                 $this->display();
 7             }
 8         public function add(){}
 9         public function edit(){}
10         public function delete(){}
11         public function update(){}
12             
13             
14         }
15 
16 
17 
18 
19 
20 
21 ?>

 

分类:

技术点:

相关文章:

  • 2021-07-17
  • 2021-12-20
  • 2021-09-05
  • 2021-10-02
  • 2022-12-23
  • 2021-11-30
  • 2022-01-27
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2021-10-03
  • 2021-08-23
  • 2022-12-23
  • 2021-10-07
相关资源
相似解决方案