1. Go to this page and download the library: Download syonix/multi-tenancy-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/ */
syonix / multi-tenancy-bundle example snippets
bash
$ php composer.phar
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Tahoe\Bundle\MultiTenancyBundle\TahoeMultiTenancyBundle(),
);
}
php
namespace Tahoe\ExampleBundle\Entity;
use Tahoe\Bundle\MultiTenancyBundle\Entity\Tenant as BaseTenant;
use Tahoe\Bundle\MultiTenancyBundle\Model\MultiTenantTenantInterface;
class Tenant extends BaseTenant implements MultiTenantTenantInterface
{
// your custom properties and methods
}
php
namespace Tahoe\ExampleBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Tahoe\Bundle\MultiTenancyBundle\Model\MultiTenantUserInterface;
class User extends BaseUser implements MultiTenantUserInterface
{
protected $id;
protected $activeTenant;
public function __construct()
{
parent::__construct();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getActiveTenant()
{
return $this->activeTenant;
}
/**
* @param mixed $activeTenant
*
* @return $this
*/
public function setActiveTenant($activeTenant)
{
$this->activeTenant = $activeTenant;
return $this;
}
}