本文整理匯總了PHP中AppBundle\Entity\User::isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::isEnabled方法的具體用法?PHP User::isEnabled怎麽用?PHP User::isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppBundle\Entity\User
的用法示例。
在下文中一共展示了User::isEnabled方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCreateNewEntity
/**
* Test creation of new entity
*/
public function testCreateNewEntity()
{
$user = new User();
$this->assertNull($user->getId());
$this->assertFalse($user->isEnabled());
$this->assertNull($user->getCreatedAt());
$this->assertNull($user->getUpdatedAt());
$this->assertNull($user->getFullName());
$this->assertNull($user->getPhone());
}
示例2: isEnabled
/**
* {@inheritDoc}
*/
public function isEnabled()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'isEnabled', []);
return parent::isEnabled();
}
示例3: switchActiveAction
/**
* @param Request $request
* @param User $user
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @Route("/switch_active/{id}", requirements={"id": "\d+"}, name="switch_active")
* @Method("GET")
*/
public function switchActiveAction(Request $request, User $user)
{
$user->setEnabled(!$user->isEnabled());
$this->getDoctrine()->getManager()->flush();
return $this->redirect($this->generateUrl('admin_users', $request->query->all()));
}
示例4: transform
/**
* Turn this item object into a generic array
*
* @return array
*/
public function transform(User $user)
{
return ['id' => (int) $user->getId(), 'username' => $user->getUsername(), 'email' => $user->getEmail(), 'lastLogin' => $user->getLastLogin(), 'enabled' => (bool) $user->isEnabled(), 'firstname' => $user->getFirstname(), 'lastname' => $user->getLastname(), 'fullname' => $user->getFullname(), 'displayname' => $user->getDisplayName()];
}