PHPackages                             ashleydawson/doctrine-gaufrette-storable-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ashleydawson/doctrine-gaufrette-storable-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

ashleydawson/doctrine-gaufrette-storable-bundle
===============================================

Symfony2 bundle to add a storable behaviour to doctrine entities to facilitate abstracted file storage

0.8.1(11y ago)0911MITPHPPHP &gt;=5.4.0

Since Sep 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/AshleyDawson/DoctrineGaufretteStorableBundle)[ Packagist](https://packagist.org/packages/ashleydawson/doctrine-gaufrette-storable-bundle)[ RSS](/packages/ashleydawson-doctrine-gaufrette-storable-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Doctrine Gaufrette Storable Bundle
==================================

[](#doctrine-gaufrette-storable-bundle)

[![Build Status](https://camo.githubusercontent.com/0b2a965ce637583c3f0ae7da9dae4ecbedb6a08c7baa6f596263ae2b3c20f581/68747470733a2f2f7472617669732d63692e6f72672f4173686c6579446177736f6e2f446f637472696e6547617566726574746553746f7261626c6542756e646c652e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/AshleyDawson/DoctrineGaufretteStorableBundle)

[![knpbundles.com](https://camo.githubusercontent.com/2c5595a9ac92f11351ba7a55579f8ea1c6f29d450b4093fa7f94d89b8f056938/687474703a2f2f6b6e7062756e646c65732e636f6d2f4173686c6579446177736f6e2f53696d706c65506167696e6174696f6e42756e646c652f62616467652d73686f7274)](http://knpbundles.com/AshleyDawson/SimplePaginationBundle)

Requirements
------------

[](#requirements)

```
 >= PHP 5.4
 >= Symfony Framework 2.3

```

Doctrine Support
----------------

[](#doctrine-support)

- Support for Doctrine ORM - Complete
- Support for Doctrine ODM - Incomplete

Introduction
------------

[](#introduction)

I built this bundle to extend the excellent filesystem abstraction layer, Knp Lab's [Gaufrette](https://github.com/KnpLabs/Gaufrette). In fact, this library extends the [KnpGaufretteBundle](https://github.com/KnpLabs/KnpGaufretteBundle).

This bundle implements an "uploaded file" handler on [Doctrine](http://www.doctrine-project.org/) entities, allowing Gaufrette to store the file as a part of the Doctrine entity lifecycle.

The first class citizen on the bundle is a **trait** that is applied to any Doctrine entity to give the Gaufrette handler the ability to persist file details along with the entity.

Installation
------------

[](#installation)

You can install the Doctrine Gaufrette Storable Bundle via Composer. To do that, simply require the package in your composer.json file like so:

```
{
    "require": {
        "ashleydawson/doctrine-gaufrette-storable-bundle": "0.8.*"
    }
}
```

Run composer update to install the package. Then you'll need to register the bundle in your app/AppKernel.php:

```
$bundles = array(
    // ...
    new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), // KnpGaufretteBundle is a dependency of this bundle
    new AshleyDawson\DoctrineGaufretteStorableBundle\AshleyDawsonDoctrineGaufretteStorableBundle(),
);
```

Configuration
-------------

[](#configuration)

Next, you'll need to configure at least one filesystem to store your files in. I'll lay out an example below, however, a better example of this can be found in the [Gaufrette Bundle documentation](https://github.com/KnpLabs/KnpGaufretteBundle#configuring-the-filesystems).

```
# app/config/config.yml
knp_gaufrette:
    adapters:
        local_adapter:
            local:
                directory: /tmp/sandbox
    filesystems:
            test_local_filesystem:
                adapter: local_adapter
```

Usage
-----

[](#usage)

In order to use this bundle, you must apply the given trait to the entities you'd like to have carry an uploaded file.

```
