nitra/acl-bundle

Installs: 550

Dependents: 0

Suggesters: 0

Security: 0

Type:symfony-bundle

dev-master 2019-08-05 12:38 UTC

This package is auto-updated.

Last update: 2020-01-05 13:32:14 UTC


README

Installing

composer require nitra/acl-bundle
<?php
// app/AppKernel.php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    // ....

    /**
     * {@inheritdoc}
     */
    public function registerBundles()
    {
        $bundles = array(
            // ....
            new Nitra\AclBundle\NitraAclBundle(),
            // ....
        );
        // ....

        return $bundles;
    }

    // ....
}

Using

<?php
// src/.../Entity/Entity.php

namespace ...\Entity;

use Doctrine\ORM\Mapping as ORM;
use Nitra\AclBundle\Annotation\Acl;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class Entity
{
    // fields

    /**
     * @Acl
     * @ORM\ManyToMany(targetEntity="User", inversedBy="entities")
     * @ORM\JoinTable(name="entity_user")
     */
    protected $users;

    // getters, setters, constuct...
}