nicolassing/sequence-bundle

Nicolassing sequence bundle allow you to create sequential number (eg reference, invoice number, ...)

dev-master / 1.0.x-dev 2018-01-25 16:23 UTC

This package is auto-updated.

Last update: 2024-11-20 06:13:22 UTC


README

[WIP] This bundle is under development. It's not suitable for production.

This bundle is heavily inspired by awesome Sylius Work ;)

INSTALLATION via Composer

composer require nicolassing/sequence-bundle

CONFIGURATION

Register the bundle:

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Nicolassing\SequenceBundle\NicolassingSequenceBundle(),
    );
    // ...
}

Create your Sequence class:

<?php
// src/AppBundle/Entity/Sequence.php

namespace AppBundle\Entity;

use Nicolassing\SequenceBundle\Model\Sequence as BaseSequence;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="sequence")
 */
class Sequence extends BaseSequence
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    
    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }
}

Configure the bundle:

# app/config/config.yml
nicolassing_sequence:
    sequence_class: AppBundle\Entity\Sequence

USAGE

TESTS

If you want to run tests, please check that you have installed dev dependencies.

./vendor/bin/phpunit