PHP code example of ozznest / security-user

1. Go to this page and download the library: Download ozznest/security-user library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ozznest / security-user example snippets

 php


namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Youshido\SecurityUserBundle\Entity\SecuredUser;

/**
 * User
 *
 * @ORM\Table(name="user")
 * @ORM\Entity
 */
class User extends SecuredUser
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    //your custom fields

 php


namespace AppBundle\Form\Type;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Youshido\SecurityUserBundle\Form\Type\SecuredUserType;

class UserType extends SecuredUserType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
    
        $builder
            ->add('plan', 'entity', [
                'class' => 'AppBundle\Entity\Plan'
            ])
            ->add('terms', 'checkbox', [
                'mapped' => false,
            ])
        ;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => 'AppBundle\Entity\User'
        ]);
    }