2017 © Pedro Peláez
 

library files

image

adt/files

  • Tuesday, July 3, 2018
  • by michallohnisky
  • Repository
  • 16 Watchers
  • 0 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 8 % Grown

The README.md

Files

Installation

$ composer require adt/files, (*1)

  • Create instance of \ADT\Files\Listeners\FileListener - parameters:
    • $dataDir is path to directory where files will be saved
    • $dataUrl is URL leading to same directory
    • implementation of Doctrine\ORM\EntityMangerInterface
  • Register \ADT\Files\Listeners\FileListener into Doctrine\Common\EventManger. If you are using kdyby ORM extension, you can do that by added tag kdyby.subscriber like this: services: - factory: ADT\Files\Listeners\FileListener(%dataFolder%/files, 'files') tags: [kdyby.subscriber]
  • Create your File entity for example:, (*2)

        use ADT\Files\Entities\IFileEntity;
        use ADT\Files\Entities\TFileEntity;
        use Doctrine\ORM\Mapping as ORM;
    
        /**
         * @ORM\Entity()
         */
        class File implements IFileEntity
        {
    
            use TFileEntity;
    
        }
    

    Feel free to add any aditional columns you need and dont forget about id/PK/identifier., (*3)

Usage

// create instance of entity
$file = new File();

// set binary data to entity as variable 
$file->setTemporaryContent($binaryContentInString, $originalFileName);

// or set path to temporary file, for example after receiving submitted form with file input 
$file->setTemporaryFile($pathToTemporaryFile, $originalFileName);

$entityManager->persist($file);
$entityManager->flush();

The Versions

03/07 2018

dev-master

9999999-dev http://appsdevteam.com

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

03/07 2018

v2.1

2.1.0.0 http://appsdevteam.com

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

19/02 2018

v2.0

2.0.0.0 http://appsdevteam.com

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

18/04 2016

1.0.1

1.0.1.0 http://appsdevteam.com

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

17/03 2016

v1.0

1.0.0.0 http://appsdevteam.com

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires