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


PHP Home::find方法代码示例

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


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

示例1: testFindAllRecursiveSelfJoin

 /**
  * testFindAllRecursiveSelfJoin method
  *
  * @return void
  */
 public function testFindAllRecursiveSelfJoin()
 {
     $this->loadFixtures('Home', 'AnotherArticle', 'Advertisement');
     $TestModel = new Home();
     $TestModel->recursive = 2;
     $result = $TestModel->find('all', array('order' => 'Home.id ASC'));
     $expected = array(array('Home' => array('id' => '1', 'another_article_id' => '1', 'advertisement_id' => '1', 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), 'AnotherArticle' => array('id' => '1', 'title' => 'First Article', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31', 'Home' => array(array('id' => '1', 'another_article_id' => '1', 'advertisement_id' => '1', 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'))), 'Advertisement' => array('id' => '1', 'title' => 'First Ad', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31', 'Home' => array(array('id' => '1', 'another_article_id' => '1', 'advertisement_id' => '1', 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), array('id' => '2', 'another_article_id' => '3', 'advertisement_id' => '1', 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')))), array('Home' => array('id' => '2', 'another_article_id' => '3', 'advertisement_id' => '1', 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'), 'AnotherArticle' => array('id' => '3', 'title' => 'Third Article', 'created' => '2007-03-18 10:43:23', 'updated' => '2007-03-18 10:45:31', 'Home' => array(array('id' => '2', 'another_article_id' => '3', 'advertisement_id' => '1', 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'))), 'Advertisement' => array('id' => '1', 'title' => 'First Ad', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31', 'Home' => array(array('id' => '1', 'another_article_id' => '1', 'advertisement_id' => '1', 'title' => 'First Home', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), array('id' => '2', 'another_article_id' => '3', 'advertisement_id' => '1', 'title' => 'Second Home', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31')))));
     $this->assertEquals($expected, $result);
 }
开发者ID:TerrasAppSolutions,项目名称:seeg-mapbiomas-workspace,代码行数:14,代码来源:ModelReadTest.php

示例2: edit

 /**
  * Show the form for editing the specified home.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $home = Home::find($id);
     return View::make('homes.edit', compact('home'));
 }
开发者ID:vnzacky,项目名称:exp_services,代码行数:11,代码来源:HomesController.php


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