Package Data | |
---|---|
Maintainer Username: | spotonlive |
Maintainer Contact: | nikolaj.lovenhardt@gmail.com (Nikolaj Petersen) |
Package Create Date: | 2015-09-09 |
Package Last Update: | 2016-01-04 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:17:04 |
Package Statistics | |
---|---|
Total Downloads: | 1,678 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 4 |
Total Forks: | 2 |
Total Open Issues: | 1 |
THIS PACKAGE IS UNDER DEVELOPMENT
Run $ composer require spotonlive/sl-entrust-doctrine-orm
config/app.php
'providers' => [
(...)
SpotOnLive\EntrustDoctrineORM\EntrustDoctrineORMServiceProvider::class,
'Zizaco\Entrust\EntrustServiceProvider',
(...)
]
'aliases' => [
(...)
'Entrust' => 'Zizaco\Entrust\EntrustFacade'
(...)
]
User.php
use Doctrine\Common\Collections\ArrayCollection;
class User implements \SpotOnLive\EntrustDoctrineORM\Entities\UserRoleInterface
{
/**
* @var \SpotOnLive\EntrustDoctrineORM\Entities\RoleInterface[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="SpotOnLive\EntrustDoctrineORM\Entities\Role")
* @ORM\JoinTable(name="user_role_linker",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")}
* )
**/
protected $roles;
public function __construct()
{
$this->roles = new ArrayCollection();
}
/**
* @return ArrayCollection|\SpotOnLive\EntrustDoctrineORM\Entities\RoleInterface[]
*/
public function getRoles()
{
return $this->roles;
}
/**
* @param ArrayCollection|\SpotOnLive\EntrustDoctrineORM\Entities\RoleInterface[] $roles
*/
public function setRoles($roles)
{
$this->roles = $roles;
}
/**
* @param \SpotOnLive\EntrustDoctrineORM\Entities\RoleInterface[] $roles
*/
public function addRoles($roles)
{
$this->roles->add($roles);
}
/**
* @param \SpotOnLive\EntrustDoctrineORM\Entities\RoleInterface[] $roles
*/
public function removeRoles($roles)
{
$this->roles->remove($roles);
}
(...)
}
Use \SpotOnLive\EntrustDoctrineORM\Traits\EntrustDoctrineORMUserTrait
in your entity.
$ vendor/bin/doctrine-laravel migrations:diff
$ vendor/bin/doctrine-laravel migrations:migrate