PHP code example of pfcode / symfony-attachment-storage

1. Go to this page and download the library: Download pfcode/symfony-attachment-storage 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/ */

    

pfcode / symfony-attachment-storage example snippets




namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Pfcode\AttachmentStorage\Entity\AttachmentInterface;

/**
 * @ORM\Entity()
 */
class MyAttachment implements AttachmentInterface
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer", nullable=false)
     * @var int|null
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255, nullable=false)
     * @var string|null
     */
    private $storageIdentifier;

    /**
     * @ORM\Column(type="string", length=8, nullable=false)
     * @var string|null
     */
    private $slug;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @var string|null
     */
    private $mimeType;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @var string|null
     */
    private $extension;

    /**
     * @ORM\Column(type="integer", nullable=false)
     * @var int
     */
    private $fileSize = 0;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @var string|null
     */
    private $originalName;

    public function setStorageIdentifier(?string $storageIdentifier): void {
        $this->storageIdentifier = $storageIdentifier;
    }

    public function getStorageIdentifier(): ?string {
        return $this->storageIdentifier;
    }

    public function setSlug(?string $slug): void {
        $this->slug = $slug;
    }

    public function getSlug(): ?string {
        return $this->slug;
    }

    public function setMimeType(?string $mimeType): void {
        $this->mimeType = $mimeType;
    }

    public function getMimeType(): ?string {
        return $this->mimeType;
    }

    public function setExtension(?string $extension): void {
        $this->extension = $extension;
    }

    public function getExtension(): ?string {
        return $this->extension;
    }

    public function setFileSize(int $bytes): void {
        $this->fileSize = $bytes;
    }

    public function getFileSize(): int {
        return $this->fileSize;
    }

    public function setOriginalName(?string $originalName): void {
        $this->originalName = $originalName;
    }

    public function getOriginalName(): ?string {
        return $this->originalName;
    }
    
    public function setId(?int $id): void {
        $this->id = $id;    
    }   

    public function getId(): ?int {
        return $this->id;
    }
}