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


PHP sfGuardUser::getTable方法代码示例

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


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

示例1: doSave

  public function doSave($con = null)
  {

    // autogenerage a suitable username
    if (!isset($values['username'])) {
      srand(time());
      $username = $this->getValue('firstname').'_'.substr($this->getValue('lastname'), 0, 1).'_'.rand(1, 1000);
            
      $usr = new sfGuardUser();
      while ($usr->getTable()->retrieveByUsername($username))
      {
        $username = $this->getValue('firstname').'_'.substr($this->getValue('lastname'), 0, 1).'_'.rand(1, 1000);
      }
   
      $this->values['username'] = $username;
    }
    
    // do all the saving magic
    return parent::doSave($con);
  }
开发者ID:romankallweit,项目名称:swingmachine,代码行数:20,代码来源:swingApplyForm.php

示例2: dirname

include dirname(__FILE__) . '/../../bootstrap/functional.php';
/**
 * This is an example class of sfTestFunctional
 * It may require some attention to work with the default values (line 40).
 */
$browser = new sfBrowser();
$test_browser = new sfTestFunctional($browser);
$test_browser->setTester('json.response', 'sfTesterJsonResponse');
$test_browser->get('/user')->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end()->with('json.response')->begin()->isJson()->end();
/**
 * Test the creation
 */
$entity = new sfGuardUser();
$entity_array = $entity->exportTo('array');
$identifier = $entity->getTable()->getIdentifier();
/**
 * Please build a valid $entity_array here
 */
unset($entity_array[$identifier]);
//$entity_array['name'] = "pony";
//$entity_array['created_at'] = date('Y-m-d H:i:s');
//$entity_array['updated_at'] = date('Y-m-d H:i:s');
$test_browser->call('/user', 'post', array('content' => json_encode($entity_array)))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'create')->end()->with('response')->begin()->isStatusCode(200)->end();
/**
 * If the new entity has been created
 */
$location = $browser->getResponse()->getHttpHeader('Location');
if ($location) {
    // Get ?
    $test_browser->get($location)->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'show')->end()->with('response')->begin()->isStatusCode(200)->end()->with('json.response')->begin()->isJson()->end();
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:30,代码来源:userActionsTest.php


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