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


PHP PhoneNumber::find方法代码示例

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


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

示例1: getDelete

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function getDelete($id, $c_id = null)
 {
     $id = $c_id ? $c_id : $id;
     $phone_number = PhoneNumber::find($id);
     $phone_number->delete();
     Event::fire('logger', array(array('phone_number_remove', array('id' => $id, 'extension' => $phone_number->extension), 2)));
     $path = Request::segment(2) == "manage" ? "manage/" . Request::segment(3) : "";
     return Output::push(array('path' => 'phone_number/' . $path, 'messages' => array('success' => _('Phone number  has been deleted'))));
 }
开发者ID:digideskio,项目名称:voip-id,代码行数:15,代码来源:PhoneNumberController.php

示例2: select

 OrmTest::assertTrue('Testing fetching object by id on new object.', $user->getName() === $name);
 $users = User::select('1=?', 1);
 OrmTest::assertTrue('Testing fetching objects by select() method.', count($users) === 4 and $users->current()->getName() !== '');
 OrmTest::assertTrue('Testing array access by id of results set.', $users[$id]->getName() !== '');
 $users = User::find(array('active' => 1));
 OrmTest::assertTrue('Testing fetching objects by find() method.', count($users) === 4 and $users->current()->getName() !== '');
 $user = User::one(array('name' => 'Jason'));
 OrmTest::assertTrue('Testing fetching object by one() method.', $user->getName() === 'Jason');
 $phone = $user->create(new PhoneNumber(array('type' => 'home', 'number' => '607-000-0000')));
 OrmTest::assertTrue('Testing create new object through create() method.', $phone instanceof PhoneNumber and $phone->getUserId() === $user->getId());
 foreach (array(111, 222, 333, 444, 555) as $prefix) {
     $user->create(new PhoneNumber(array('type' => 'home', 'number' => '607-' . $prefix . '-0000', 'location' => null)))->save();
 }
 OrmTest::assertTrue('Loading records to test method appication to entire results set.', true);
 PhoneNumber::select('`number` like "607%" and `location` IS NULL order by `number`')->setLocation('Ithaca, NY')->setType('Cell Phone')->save();
 $phones = PhoneNumber::find(array('location' => 'Ithaca, NY', 'type' => 'Cell Phone'));
 OrmTest::assertTrue('Checking to see if method application applied correctly.', count($phones) === 5);
 OrmTest::assertTrue('Testing getRelationClassName style magic method (singular).', $user->getPhoneNumber()->getLocation() === 'Ithaca, NY');
 OrmTest::assertTrue('Testing getRelationClassName style magic method (list) .', count($user->getPhoneNumber(true)) === 5 and $user->getPhoneNumber(true)->current()->getLocation() === 'Ithaca, NY');
 OrmTest::assertTrue('Testing getRelationClassName style magic method (custom) .', $user->getPhoneNumber('`number` like ?', "%111%")->current()->getNumber() === '607-111-0000');
 $post = $user->create(new Post(array('title' => 'test post', 'body' => "I ain't got no body..")));
 $post->addMeta(array('background' => 'blue', 'border' => '1px solid grey'));
 $post->setMeta('border', '2px solid white');
 OrmTest::assertTrue('Testing addMeta(), setMeta() and getMeta() methods.', $post->getMeta('background') === 'blue' and $post->getMeta('border') === '2px solid white');
 $post->save();
 $post = $user->getPost();
 OrmTest::assertTrue('Testing getMeta() methods after save().', $post->getMeta('background') === 'blue' and $post->getMeta('border') === '2px solid white');
 $post->delete();
 OrmTest::assertTrue('Testing delete() method on an object.', count($user->getPost(true)) === 0);
 OrmTest::assertTrue('Testing complete. (' . OrmTest::$fails . ' fails)', !OrmTest::$fails);
 Db::execute("drop database {$dbname}");
开发者ID:jasonmoo,项目名称:DumbledORM,代码行数:31,代码来源:test.php


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