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


PHP Version::find方法代码示例

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


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

示例1: current_version

 public function current_version()
 {
     try {
         return Version::find('first', array('order' => 'created_at DESC', 'conditions' => array('package_id' => $this->id)));
     } catch (NimbleRecordNotFound $e) {
         return false;
     }
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:8,代码来源:package.php

示例2: testDeleteBobsPackage

 public function testDeleteBobsPackage()
 {
     $_SERVER['SERVER_NAME'] = 'bob.localhost.com';
     $count = Version::count();
     $p = Package::find_by_name('bobs_other_package');
     $v = Version::find('first', array('package_id' => $p->id, 'version' => '0.0.1'));
     $this->delete('delete', array(), array('id' => $v->package_id, 'version' => $v->id), array('user' => User::find_by_username('bob')->id));
     $this->assertEquals($count - 1, Version::count(array('cache' => false)));
     $this->assertFalse(Version::exists('id', $v->id));
     $this->assertRedirect(url_for('PackageController', 'show', $p->id));
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:11,代码来源:VersionControllerTest.php

示例3: Version

 function _detectProjectId()
 {
     $project_id = null;
     if (isset($this->controller->params['project_id'])) {
         $project_id = $this->controller->params['project_id'];
     }
     if ($this->controller->name == 'Versions') {
         $version_id = $this->controller->params['pass'][0];
         App::uses('Version', 'Model');
         $version = new Version();
         $bind = array('belongsTo' => array('Project' => array('className' => 'Project')));
         $version->bindModel($bind);
         $version_row = $version->find('first', array('condtions' => array('id' => $version_id)));
         $project_id = $version_row['Project']['identifier'];
     }
     return $project_id;
 }
开发者ID:gildonei,项目名称:candycane,代码行数:17,代码来源:MenuManagerComponent.php

示例4: delete

 public function delete()
 {
     $this->login_user();
     try {
         $package = Package::find($_GET['id']);
         $version = Version::find($_GET['version']);
     } catch (NimbleRecordNotFound $e) {
         $this->redirect_to('/');
     }
     if ($version->package_id == $package->id && $package->user_id == $this->user->id) {
         $file = $package->file_path($version->version);
         @unlink($file);
         Nimble::flash('notice', "Version: {$version->version} was deleted");
         $version->delete();
         $this->redirect_to(url_for('PackageController', 'show', $package->user->username, $package->name));
     } else {
         $this->redirect_to('/');
     }
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:19,代码来源:version_controller.php

示例5: index

 /**
  * index
  */
 public function index()
 {
     switch ($this->format) {
         case 'xml':
             if ($this->user->active == 0) {
                 exit;
             }
             $this->layout = false;
             $this->render('channel/index.xml');
             $this->header('Content-Type: text/xml', 200);
             $this->current_version = Version::find('first', array('select' => 'versions.*', 'joins' => 'INNER JOIN packages on versions.package_id = packages.id INNER JOIN users ON users.id = packages.user_id', 'order' => 'versions.version DESC'));
             $date = DateHelper::from_db($this->current_version->created_at);
             $date = date(DATE_RFC822, $date);
             $this->header("Last-Modified: {$date}");
             break;
         default:
             $this->packages = $this->user->packages;
             $this->header('Content-Type: text/html', 200);
             break;
     }
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:24,代码来源:channel_controller.php

示例6: compare

 public function compare()
 {
     //$this->output->enable_profiler(true);
     $this->load->model('Version');
     $this->form_validation->set_rules('version_before', 'Version', 'required|integer');
     $this->form_validation->set_rules('version_after', 'Version', 'required|integer');
     $data = array();
     if ($this->form_validation->run() === true) {
         $version_before = Version::find($this->input->post('version_before'));
         $version_after = Version::find($this->input->post('version_after'));
         if ($version_before !== false && $version_after !== false) {
             $comparison = $version_after->compare_to($version_before);
             /*
             echo '<pre>';
             var_dump($comparison);
             echo '</pre>';
             */
             $data['comparison'] = $comparison;
         }
     }
     $this->layout->add_basic_assets()->menu()->action_view($data);
 }
开发者ID:vmoulin77,项目名称:DVB,代码行数:22,代码来源:Version_controller.php

示例7: load_release

 private function load_release()
 {
     $this->package = Package::find('first', array('conditions' => array('name' => $_GET['name'], 'user_id' => $this->user->id)));
     $date = DateHelper::from_db($this->package->updated_at);
     $date = date(DATE_RFC822, $date);
     $this->header("Last-Modified: {$date}");
     $this->version = Version::find('first', array('conditions' => array('version' => $_GET['version'], 'package_id' => $this->package->id)));
     $this->data = unserialize($this->version->meta);
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:9,代码来源:rest_controller.php

示例8: tag

 public function tag()
 {
     if (empty($_GET['url'])) {
         exit;
     }
     # TODO
     $versions = Version::find(array("placeholders" => true, "where" => array("tags like" => "%: \"" . $_GET['url'] . "\"\n%")));
     $this->display("extend/tag", array("versions" => new Paginator($versions, 25), "tag" => fix($_GET['url'])), fix(_f("Versions tagged with \"%s\"", $_GET['url'], "extend")));
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:9,代码来源:controller.Extend.php

示例9: storeLink

 /**
  * Links a plugin to an application
  * GET /application/{appid}/link
  *
  * @param  int  $appid
  * @return Response
  */
 public function storeLink($appid, $pluginid)
 {
     intval($pluginid);
     intval($appid);
     $rules = ['version' => 'required|integer'];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator->messages());
     }
     if (Version::find(Input::get('version')) && Application::find($appid)) {
         Application::find($appid)->versions()->attach(Input::get('version'));
         return Redirect::action('application.show', [$appid])->withSuccess('Plugin connected.');
     } else {
         return Redirect::action('application.index')->withErrors(['Version or application does not exist.']);
     }
 }
开发者ID:Devided,项目名称:Versions,代码行数:23,代码来源:ApplicationController.php

示例10: load_release

 private function load_release()
 {
     $this->package = Package::find('first', array('conditions' => array('name' => $_GET['name'], 'user_id' => $this->user->id)));
     $this->version = Version::find('first', array('conditions' => array('version' => $_GET['version'], 'package_id' => $this->package->id)));
     $this->data = unserialize($this->version->meta);
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:6,代码来源:rest_controller.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /version/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($pluginid, $versionid)
 {
     intval($versionid);
     intval($versionid);
     Version::find($versionid)->delete();
     return Redirect::action('PluginController@show', [$pluginid])->withSuccess('Version removed.');
 }
开发者ID:Devided,项目名称:Versions,代码行数:14,代码来源:VersionController.php


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