PHP code example of c975l / user-files-bundle

1. Go to this page and download the library: Download c975l/user-files-bundle 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/ */

    

c975l / user-files-bundle example snippets



class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new FOS\UserBundle\FOSUserBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new c975L\EmailBundle\c975LEmailBundle(),
            new c975L\UserFilesBundle\c975LUserFilesBundle(),
        ];
    }
}



namespace UserFilesBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class UserFilesBundle extends Bundle
{
    public function getParent()
    {
        return 'c975LUserFilesBundle';
    }
}



//Change the namespace
namespace UserFilesBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\HttpFoundation\Request;
use c975L\UserFilesBundle\Validator\Constraints as UserFilesBundleAssert;
use c975L\UserFilesBundle\Validator\Constraints\Challenge;
//...

/**
 * @ORM\Entity
 */
class User extends BaseUser
{
    //Keep all the fields and functions and add your own
}



//Change the namespace
namespace UserFilesBundle\Form;

//...
use c975L\UserFilesBundle\Form\ProfileType as BaseProfileType;

class ProfileType extends BaseProfileType
{
    //Do your stuff...
}




//Change the namespace
namespace UserFilesBundle\Controller;

//...
use c975L\UserFilesBundle\Controller\UserController as BaseController;

class UserController extends BaseController
{
//DELETE USER
    /**
     * @Route("/delete",
     *      name="userfiles_delete_account")
     * @Method({"GET", "HEAD", "POST"})
     */
    public function deleteAccountAction(Request $request)
    {
        parent::deleteAccountAction($request);
        //Do your stuff...
    }
}