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


PHP Restaurant::unbindModel方法代码示例

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


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

示例1: testBehaviorBelongsToFindCallbacks

 /**
  * testBehaviorBelongsToFindCallbacks method
  *
  * @return void
  */
 public function testBehaviorBelongsToFindCallbacks()
 {
     $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.');
     $conditions = array('order' => 'Apple.id ASC');
     $Apple = new Restaurant();
     $Apple->unbindModel(array('hasMany' => array('Child'), 'hasOne' => array('Sample')), false);
     $expected = $Apple->find('all', $conditions);
     $Apple->unbindModel(array('belongsTo' => array('Parent')));
     $wellBehaved = $Apple->find('all', $conditions);
     $Apple->Parent->Behaviors->load('Test');
     $Apple->unbindModel(array('belongsTo' => array('Parent')));
     $this->assertSame($Apple->find('all', $conditions), $wellBehaved);
     $Apple->Parent->Behaviors->load('Test', array('before' => 'off'));
     $this->assertSame($expected, $Apple->find('all', $conditions));
     $Apple->Parent->Behaviors->load('Test', array('before' => 'test'));
     $this->assertSame($expected, $Apple->find('all', $conditions));
     $Apple->Parent->Behaviors->load('Test', array('before' => 'modify'));
     $expected2 = array(array('Apple' => array('id' => 1), 'Parent' => array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17')), array('Apple' => array('id' => 2), 'Parent' => array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17')), array('Apple' => array('id' => 3), 'Parent' => array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17')));
     $result2 = $Apple->find('all', array('fields' => array('Apple.id', 'Parent.id', 'Parent.name', 'Parent.mytime'), 'conditions' => array('Apple.id <' => '4'), 'order' => 'Apple.id ASC'));
     $this->assertEquals($expected2, $result2);
     $Apple->Parent->Behaviors->disable('Test');
     $result = $Apple->find('all', $conditions);
     $this->assertEquals($expected, $result);
     $Apple->Parent->Behaviors->load('Test', array('after' => 'off'));
     $this->assertEquals($expected, $Apple->find('all', $conditions));
     $Apple->Parent->Behaviors->load('Test', array('after' => 'test'));
     $this->assertEquals($expected, $Apple->find('all', $conditions));
     $Apple->Parent->Behaviors->load('Test', array('after' => 'test2'));
     $this->assertEquals($expected, $Apple->find('all', $conditions));
 }
开发者ID:nogikko,项目名称:yumyum,代码行数:35,代码来源:BehaviorCollectionTest.php


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