当前位置: 首页>>代码示例>>PHP>>正文


PHP L::save方法代码示例

本文整理汇总了PHP中L::save方法的典型用法代码示例。如果您正苦于以下问题:PHP L::save方法的具体用法?PHP L::save怎么用?PHP L::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在L的用法示例。


在下文中一共展示了L::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new L();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['L'])) {
         $model->attributes = $_POST['L'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:17,代码来源:LookupsController.php

示例2: testManyManyRelationSqlQuery

 /**
  * @depends testHasManyRelationSqlQuery
  */
 public function testManyManyRelationSqlQuery()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //I has many ls.
     $i = new I();
     $l = new L();
     $l->lMember = 'def';
     $this->assertTrue($l->save());
     $i->iMember = 'abc';
     $i->ls->add($l);
     $this->assertTrue($i->save());
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'ls', 'relatedAttributeName' => 'lMember', 'operatorType' => 'equals', 'value' => 'somevalue'));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('I');
     $quote = DatabaseCompatibilityUtil::getQuote();
     $where = RedBeanModelDataProvider::makeWhere('I', $searchAttributeData, $joinTablesAdapter);
     $compareWhere = "({$quote}l{$quote}.{$quote}lmember{$quote} = 'somevalue')";
     $this->assertEquals($compareWhere, $where);
     //Now test that the joinTablesAdapter has correct information.
     $this->assertEquals(0, $joinTablesAdapter->getFromTableJoinCount());
     $this->assertEquals(2, $joinTablesAdapter->getLeftTableJoinCount());
     $leftTables = $joinTablesAdapter->getLeftTablesAndAliases();
     $this->assertEquals('i_l', $leftTables[0]['tableName']);
     $this->assertEquals('l', $leftTables[1]['tableName']);
     //Now test that the subsetSQL query produced is correct.
     $subsetSql = I::makeSubsetOrCountSqlQuery('i', $joinTablesAdapter, 1, 5, $where, null, false, $joinTablesAdapter->getSelectDistinct());
     $compareSubsetSql = "select distinct {$quote}i{$quote}.{$quote}id{$quote} id ";
     $compareSubsetSql .= "from {$quote}i{$quote} ";
     $compareSubsetSql .= "left join {$quote}i_l{$quote} on ";
     $compareSubsetSql .= "{$quote}i_l{$quote}.{$quote}i_id{$quote} = {$quote}i{$quote}.{$quote}id{$quote} ";
     $compareSubsetSql .= "left join {$quote}l{$quote} on ";
     $compareSubsetSql .= "{$quote}l{$quote}.{$quote}id{$quote} = {$quote}i_l{$quote}.{$quote}l_id{$quote} ";
     $compareSubsetSql .= "where " . $compareWhere . ' ';
     $compareSubsetSql .= 'limit 5 offset 1';
     $this->assertEquals($compareSubsetSql, $subsetSql);
     //Make sure the sql runs properly.
     $dataProvider = new RedBeanModelDataProvider('I', null, false, $searchAttributeData);
     $data = $dataProvider->getData();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:44,代码来源:RedBeanModelDataProviderTest.php


注:本文中的L::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。