/**
  * @param string $path
  * @param array  $parameters
  */
 protected function ensureTenancyInParameters($path, &$parameters)
 {
     if (stripos($path, 'tenant_owner_id') !== false && !isset($parameters['tenant_owner_id'])) {
         $parameters['tenant_owner_id'] = $this->tenant->getTenantOwnerId();
     }
     if (stripos($path, 'tenant_creator_id') !== false && !isset($parameters['tenant_creator_id'])) {
         $parameters['tenant_creator_id'] = $this->tenant->getTenantCreatorId();
     }
 }
 /**
  * @param QueryBuilder $qb
  * @param string       $alias
  */
 protected function applyClosedSecurityModel(QueryBuilder $qb, $alias)
 {
     $qb->where("{$alias}.tenantOwnerId = :tenantOwnerId")->andWhere("{$alias}.tenantCreatorId = :tenantCreatorId")->setParameters([':tenantOwnerId' => $this->tenant->getTenantOwnerId(), ':tenantCreatorId' => $this->tenant->getTenantCreatorId()]);
 }
 /**
  * @param TenantContract $tenant
  *
  * @return $this
  */
 public function importTenancyFrom(TenantContract $tenant)
 {
     $this->setTenantOwnerId($tenant->getTenantOwnerId());
     $this->setTenantCreatorId($tenant->getTenantCreatorId());
     return $this;
 }