PHP code example of php-solution / file-storage-bundle

1. Go to this page and download the library: Download php-solution/file-storage-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/ */

    

php-solution / file-storage-bundle example snippets




namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use PhpSolution\Doctrine\Entity\IdGeneratedTrait;
use PhpSolution\FileStorageBundle\Entity\AbstractUploadedFile;
use PhpSolution\StdLib\FrequentField\Interfaces\IdentifiableInterface;

/**
 * @ORM\Entity()
 * @ORM\Table(name="file")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="type", type="string")
 */
abstract class AbstractFile extends AbstractUploadedFile implements IdentifiableInterface
{
    use IdGeneratedTrait;
}



namespace AppBundle\Entity;

use AppBundle\Entity\AbstractFile;

/**
 * CustomFile
 */
class CustomFile extends AbstractFile
{
    /**
     * @return string
     */
    public function getStorageBucket(): string
    {
        return 'custom';
    }
}
` bash
$ composer