本文整理汇总了PHP中sfGuardUser::getPrimaryKey方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::getPrimaryKey方法的具体用法?PHP sfGuardUser::getPrimaryKey怎么用?PHP sfGuardUser::getPrimaryKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::getPrimaryKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeFollower
public function removeFollower(sfGuardUser $user)
{
$assoFollower = AbonnementTable::getInstance()->getCurrentAssoFollower($this->getPrimaryKey(), $user->getPrimaryKey())->fetchOne();
$assoFollower->delete();
}
示例2: _create_object
// objects creation
$object1 = _create_object();
$object1->setName('one');
$object1->save();
$object2 = _create_object();
$object2->setName('two');
$object2->save();
$user1 = new sfGuardUser();
$user1->setUsername('one');
$user1->save();
$t->ok(is_numeric($object1->getRecommendationScore()), 'getRecommendationScore() returns numeric value');
$t->is($object1->getRecommendationScore(), 0, 'getRecommendationScore() object 1 score initialized : 0');
$t->ok($object1->recommend(), 'recommend() object 1');
$t->is($object1->getRecommendationScore(), 1, 'getRecommendationScore() object 1 score updated : 1');
$object2->recommend();
$object2->recommend();
$object2->recommend();
$t->is($object1->getRecommendationScore(), 1, 'getRecommendationScore() object 1 score not updated : 1');
$t->is($object2->getRecommendationScore(), 3, 'getRecommendationScore() object 2 score updated : 3');
$t->ok($object1->recommend($user1->getPrimaryKey()), 'recommend() a user can recommend object 1 once');
$t->ok(!$object1->recommend($user1->getPrimaryKey()), 'recommend() a user cannot recommend object 1 twice');
$t->ok($object2->recommend($user1->getPrimaryKey()), 'recommend() a user can recommend object 2');
// test object creation
function _create_object()
{
$classname = TEST_CLASS;
if (!class_exists($classname)) {
throw new Exception(sprintf('Unknow class "%s"', $classname));
}
return new $classname();
}
示例3: removeFollower
public function removeFollower(sfGuardUser $user, Service $service)
{
$assoFollower = MembreServiceTable::getInstance()->getCurrentServiceFollower($service->getPrimaryKey(), $user->getPrimaryKey())->fetchOne();
$assoFollower->delete();
}