本文整理汇总了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()];
}