ytko/doctrine-uploadable

Doctrine2 behavior uploadable trait

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 1

pkg:composer/ytko/doctrine-uploadable

dev-master 2013-03-04 20:20 UTC

This package is not auto-updated.

Last update: 2025-10-25 20:04:54 UTC


README

This php 5.4+ library provides file uploading trait for Doctrine2 entities.

This library needs Doctrine listener to be activated.

Listeners

Symfony2:

    # app/config/config.yml
    imports:
        - { resource: ../../vendor/ytko/doctrine-uploadable/config/orm-services.yml }

Or Doctrine2 api:

<?php

$em->getEventManager()->addEventSubscriber(new \Ytko\DoctrineBehaviors\ORM\UploadableListener);

Usage

Define a Doctrine2 entity and use traits:

<?php

use Doctrine\ORM\Mapping as ORM;
use Ytko\DoctrineBehaviors\Model\Uploadable;

/**
 * @ORM\Entity
 */
class Category
{
    use Uploadable;

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="NONE")
     */
    protected $id;
}

Inspired by KnpLabs/DoctrineBehaviors.