1. Go to this page and download the library: Download eziat/permission-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eziat / permission-bundle example snippets
// config/bundles.php
return [
//...
new Eziat\PermissionBundle\EziatPermissionBundle(),
//...
];
// src/Entity/Permission.php
namespace App\Entity;
use Eziat\PermissionBundle\Entity\Permission as BasePermission;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="permission")
*/
class Permission extends BasePermission
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function getId()
{
return $this->id;
}
// Your other logic.
}
// src/Entity/User.php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Eziat\PermissionBundle\Model\UserPermissionInterface;
/**
* @ORM\Entity
*/
class User implements UserPermissionInterface
{
/**
* @ORM\ManyToMany(targetEntity="Permission")
* @ORM\JoinTable(name="users_permissions",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="permission_id", referencedColumnName="id")}
* )
*/
protected $permissions;
public function getId()
{
return $this->id;
}
public function getPermissions() : array
{
return $this->permissions;
}
// Your other logic.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.