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


PHP Person::get方法代码示例

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


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

示例1: testAdd

 /**
  * @covers QueueController::Add
  * @todo Implement testAdd().
  */
 public function testAdd()
 {
     $person = Person::factory('adult');
     $person->name = 'Poehavshiy';
     $person->add();
     $store = Store::factory('Grocery');
     $store->name = 'Prison';
     $store->add();
     $product = new Product();
     $product->name = 'Sladkiy hleb';
     $product->add();
     $request = Application::getInstance()->request;
     $request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
     $personId = $request->p('personId');
     $storeId = $request->p('storeId');
     $store = Store::get($storeId);
     $person = Person::get($personId);
     $store->queue->add($person);
     $person->basket->drop();
     $name = 'product_' . $product->id;
     $value = $product;
     if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
         $person->basket->add(Product::get($matches[1][0]));
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:29,代码来源:QueueControllerTest.php

示例2: testOneToOneRelation

 public function testOneToOneRelation()
 {
     $person = Person::get(1);
     $partner = $person->partner;
     $this->assertTrue($partner instanceof Person, 'must be a Person instance');
     $this->assertEquals(2, $partner->id, 'partner id');
 }
开发者ID:arwyn,项目名称:PHP-Elixir,代码行数:7,代码来源:ReadTest.php

示例3: hasmany

 public function hasmany()
 {
     $author = Person::get()->first();
     $posts = $author->Posts();
     $posts->toArray();
     $content .= '$author = Person::get()->first(); <br>';
     $content .= '$posts = $author->Posts(); <br>';
     $content .= '$posts->toArray(); <br>';
     return $this->customise(new ArrayData(array('Title' => "Performance: {$this->dbType} has many", 'Content' => $content)))->renderWith(array('PerformanceController', 'AppController'));
 }
开发者ID:Cumquat,项目名称:silverstripe-orientdb-poc,代码行数:10,代码来源:PerformanceController.php

示例4: Remove

 public function Remove()
 {
     $this->_response()->asJSON();
     try {
         $person = Person::get($this->_request()->g('id'));
         $person->remove();
         return array('success' => 1);
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:11,代码来源:PersonController.php

示例5: editar_persona_area

 public function editar_persona_area()
 {
     $fk_persona = Person::get()->lists('full_name', 'id');
     $fk_area = Area_Interes::get()->lists('area_interes_nombre', 'id');
     $inputs = Input::get('idedit');
     $persona_area = Persona_Area_Interes::find($inputs);
     if ($persona_area) {
         return View::make('persona_area_interes.createPersonaArea', array('fk_persona' => $fk_persona, 'fk_area' => $fk_area, 'persona_area' => $persona_area));
     } else {
         return Redirect::to('persona_area');
     }
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:12,代码来源:PersonaAreaController.php

示例6: Save

 /**
  * Сохраняет информацию об корзине покупателя
  * 
  *  Принимает: personId, product_id1, product_id2, ...
  * 
  * @return type 
  */
 public function Save()
 {
     $this->_response()->asJSON();
     try {
         $person = Person::get($this->_request()->p('personId'));
         $person->basket;
         $map = array();
         foreach ($_POST as $name => $value) {
             if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
                 $map[$matches[1][0]] = $value;
             }
         }
         $person->basket->map($map);
         return array('success' => true);
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:25,代码来源:BasketController.php

示例7: action_oa

 /**
  * oa登录
  * @param $ticket
  */
 public function action_oa($ticket)
 {
     if (TXApp::$base->person->exist()) {
         TXApp::$base->request->redirect('/');
     }
     if ($ticket) {
         $client = new \SoapClient($this->oa_wsdl_url);
         $res = $client->DecryptTicket(['encryptedTicket' => $ticket]);
         $rtx = $res->DecryptTicketResult->LoginName;
         if ($user = $this->userDAO->filter(['name' => $rtx])->find()) {
             Person::get($user['id'])->login();
         } else {
             $id = $this->userDAO->add(['name' => $rtx, 'registerTime' => time()]);
             Person::get($id)->login();
         }
         TXApp::$base->request->redirect('/');
     } else {
         $url = TXApp::$base->request->getBaseUrl(true) . '/login/oa';
         TXApp::$base->request->redirect("http://login.oa.com/modules/passport/signin.ashx?url={$url}");
     }
 }
开发者ID:billge1205,项目名称:biny,代码行数:25,代码来源:loginAction.php

示例8: auth_authentificate

/**
 * Tests if login and password match one and only one person record.
 * @param string $login user login.
 * @param type $password user password (plain).
 * @return boolean returns TRUE on successful or existing authentification, FALSE otherwise.
 */
function auth_authentificate($login, $password)
{
    if (auth_is_authentificated()) {
        return TRUE;
    }
    $CI =& get_instance();
    $CI->load->library('session');
    $person = new Person();
    $person->where('enabled', 1);
    $person->where('login', $login);
    $person->where('password', sha1($password));
    $person->get();
    if ($person->exists() && $person->result_count() == 1) {
        $GLOBALS['ledcoin-user-data'] = $person->to_array();
        unset($GLOBALS['ledcoin-user-data']['password']);
        unset($GLOBALS['ledcoin-user-data']['created']);
        unset($GLOBALS['ledcoin-user-data']['updated']);
        $GLOBALS['ledcoin-user-auth'] = TRUE;
        $CI->session->set_userdata('user-id', $person->id);
        return TRUE;
    }
    return FALSE;
}
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:29,代码来源:auth_helper.php

示例9: date

/**
 * Create some sample data.
 */
$person = Person::fromArray(["name" => "Freddy Mercury"]);
$person->save();
$personID = $person->id;
$postDate = date('Y-m-d');
$postNo = 1;
$post = Post::fromArray(['date' => $postDate, 'no' => $postNo, 'title' => "My only post"]);
$post->save();
/**
 * To fetch a single record by it's primary key use:
 * 	- Model::get()  - throws an exception if record does not exist
 *  - Model::find() - returns NULL if record does not exist
 */
$person = Person::get($personID);
$person = Person::find($personID);
/**
 * Also works for composite primary keys.
 */
$post = Post::get($postDate, $postNo);
$post = Post::find($postDate, $postNo);
/**
 * You can pass the composite primary key as an array.
 */
$postID = array($postDate, $postNo);
$post = Post::get($postID);
$post = Post::find($postID);
echo SEPARATOR . "This is person #10:\n";
print_r($person);
echo SEPARATOR . "This is Post {$postDate} #{$postNo}:\n";
开发者ID:Macavity,项目名称:phormium,代码行数:31,代码来源:models-read.php

示例10: Person

 function people_get()
 {
     if (!$this->get('search')) {
         $this->response(NULL, 400);
     }
     //echo $this->get('search');
     $people = new Person();
     $people->select('id, name, pfsnumber, public, country');
     $people->or_like('name', $this->get('search'));
     $people->or_like('pfsnumber', $this->get('search'));
     $people->order_by('name', 'asc');
     $people->limit(5);
     $people->get();
     if ($people->exists()) {
         $people_array = $people->all_to_array();
         $this->response($people_array, 200);
         // 200 being the HTTP response code
     } else {
         $this->response(array('error' => 'People could not be found'), 404);
     }
 }
开发者ID:TetsujinOni,项目名称:PFS-Scenariotracker,代码行数:21,代码来源:V1.php

示例11: generate

 public function generate($type = 0)
 {
     $scenario_options = array('played_most', 'played_least', 'season', 'evergreen');
     $person_options = array('player_complete_pfs', 'player_complete_core', 'gm_complete_pfs', 'gm_complete_core');
     if (in_array($type, $scenario_options)) {
         // This is a scenario based statistic
         $scenarios = new Scenario();
         $scenarios->where('archived IS NULL', NULL);
         if ($type == 'evergreen') {
             $scenarios->where('evergreen', '1');
         }
         $scenarios->get();
         $options = array();
         foreach ($scenarios as $scenario) {
             $options[$scenario->id] = $scenario->players->count();
         }
         // Sort
         if ($type == 'played_least') {
             asort($options);
         } else {
             arsort($options);
         }
         // Select only top 5
         $options = array_slice($options, 0, 10, true);
         // Delete old data
         $this->where('type', $type)->get()->delete_all();
         $number = 1;
         foreach ($options as $key => $option) {
             $this->clear();
             $this->type = $type;
             $this->number = $number;
             $this->scenario_id = $key;
             $this->comment = $option;
             $this->created_on = date("Y-m-d H:i:s");
             $this->save();
             $number++;
         }
     } else {
         // This is a person based statistic
         $people = new Person();
         $people->get();
         $number = 1;
         $options = array();
         foreach ($people as $person) {
             if ($type == 'player_complete_pfs') {
                 $scenarios = $person->scenarios->where_join_field('players', 'pfs IS NOT NULL', NULL, FALSE)->where('archived IS NULL', NULL)->get();
                 $options[$person->id] = $scenarios->result_count();
             } elseif ($type == 'gm_complete_pfs') {
                 $scenarios = $person->scenarios->where_join_field('players', 'pfs_gm IS NOT NULL', NULL, FALSE)->where('archived IS NULL', NULL)->get();
                 $options[$person->id] = $scenarios->result_count();
             } elseif ($type == 'player_complete_core') {
                 $scenarios = $person->scenarios->where_join_field('players', 'core IS NOT NULL', NULL, FALSE)->where('archived IS NULL', NULL)->get();
                 $options[$person->id] = $scenarios->result_count();
             } elseif ($type == 'gm_complete_core') {
                 $scenarios = $person->scenarios->where_join_field('players', 'core_gm IS NOT NULL', NULL, FALSE)->where('archived IS NULL', NULL)->get();
                 $options[$person->id] = $scenarios->result_count();
             }
         }
         // Sort
         arsort($options);
         // Select only top 5
         $options = array_slice($options, 0, 10, true);
         // Delete old data
         $this->where('type', $type)->get()->delete_all();
         // Get total amount of scenarios
         $scenarios = new Scenario();
         $total = $scenarios->where('archived IS NULL', NULL)->count();
         foreach ($options as $key => $option) {
             $this->clear();
             $this->type = $type;
             $this->number = $number;
             $this->person_id = $key;
             $this->comment = $option . '/' . $total;
             $this->save();
             $number++;
         }
     }
     return TRUE;
 }
开发者ID:TetsujinOni,项目名称:PFS-Scenariotracker,代码行数:79,代码来源:Statistic.php

示例12: date

// Include Phormium and models
require __DIR__ . "/../vendor/autoload.php";
require __DIR__ . "/models/Contact.php";
require __DIR__ . "/models/Person.php";
require __DIR__ . "/models/Post.php";
require __DIR__ . "/models/Tag.php";
$date = date('Y-m-d');
// Configure Phormium
\Phormium\DB::configure('config.json');
// Create a person and three contacts
Person::fromArray(["id" => 1, "name" => "Ivan"])->save();
Contact::fromArray(["id" => 1, "person_id" => 1, "value" => "foo"])->save();
Contact::fromArray(["id" => 2, "person_id" => 1, "value" => "bar"])->save();
Contact::fromArray(["id" => 3, "person_id" => 1, "value" => "baz"])->save();
// Fetch the person, then get her contacts
$person = Person::get(1);
$contacts = $person->contacts()->fetch();
print_r($contacts);
// Fetch the contact, then get the person it belongs to
$contact = Contact::get(1);
$person = $contact->person()->single();
print_r($person);
// Create a post and three tags
Post::fromArray(["date" => $date, "no" => 1, "title" => "Post #1"])->save();
Tag::fromArray(["id" => 1, "post_date" => $date, "post_no" => 1, "value" => "Tag #1"])->save();
Tag::fromArray(["id" => 2, "post_date" => $date, "post_no" => 1, "value" => "Tag #2"])->save();
Tag::fromArray(["id" => 3, "post_date" => $date, "post_no" => 1, "value" => "Tag #3"])->save();
// Fetch a post, then fetch it's tags
$post = Post::get($date, 1);
$tags = $post->tags()->fetch();
print_r($tags);
开发者ID:Macavity,项目名称:phormium,代码行数:31,代码来源:relations.php

示例13: __get

 /**
  * 获取单例全局量
  * @param $name
  * @return mixed
  * @throws TXException
  */
 public function __get($name)
 {
     switch ($name) {
         case 'person':
             return Person::get();
         case 'request':
             return TXRequest::getInstance();
         case 'redis':
             return TXRedis::instance();
         case 'memcache':
             return TXMemcache::instance();
         case 'session':
             return TXSession::instance();
         case 'router':
         case 'cache':
             $module = 'TX' . ucfirst($name);
             return TXFactory::create($module);
         default:
             throw new TXException(1006, $name);
     }
 }
开发者ID:billge1205,项目名称:biny,代码行数:27,代码来源:TXApp.php

示例14: testLimitAndOrderBy

 /**
  * Test the \DenBeke\ORM\ORM::setOptions() method for 'limit' and 'orderBy' options
  *
  * @depends testInit
  */
 public function testLimitAndOrderBy()
 {
     $person = new Person(['name' => 'C', 'city' => 'CC']);
     $id = $person->add();
     $person = new Person(['name' => 'D', 'city' => 'DD']);
     $id = $person->add();
     $options = ['orderBy' => ['name', 'ASC'], 'limit' => 2];
     $persons = Person::get($options);
     $this->assertEquals('Alice', $persons[0]->name);
     $this->assertEquals('Bob', $persons[1]->name);
     $this->assertEquals(2, sizeof($persons));
 }
开发者ID:denbeke,项目名称:orm,代码行数:17,代码来源:ORMTest.php


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