nitra/acl-bundle

Installs: 556

Dependents: 0

Suggesters: 0

Security: 0

Type:symfony-bundle

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

This package is auto-updated.

Last update: 2024-09-05 23:43:01 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...
}