src/Tenant/Doctrine/ORM/Filter/TenantFilter.php
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
    {
        if (!$targetEntity->reflClass->implementsInterface(Tenantable::class)) {
            return '';
        }

        $tenant = trim($this->getParameter('tenant'), '\'');

        if ('' === $tenant) {
            $constraint = sprintf('%s.tenant is NULL', $targetTableAlias);
        } else {
            $constraint = sprintf('%s.tenant = \'%s\'', $targetTableAlias, $tenant);
        }

        return $constraint;
    }
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
    {
        if (!$targetEntity->reflClass->implementsInterface(Tenantable::class)) {
            return '';
        }

        $tenant = trim($this->getParameter('tenant'), '\'');

        if ('' === $tenant) {
            $constraint = sprintf('%s.tenant is NULL', $targetTableAlias);
        } else {
            $constraint = sprintf('%s.tenant = \'%s\'', $targetTableAlias, $tenant);
        }

        return $constraint;
    }
public function addFilterConstraint ( ClassMetadata $ targetEntity , $ targetTableAlias ) { if ( ! $ targetEntity -> reflClass -> implementsInterface ( Tenantable :: class ) ) { return '' ; } $ tenant = trim ( $ this -> getParameter ( 'tenant' ) , '\'' ) ; if ( '' === $ tenant ) { $ constraint = sprintf ( '%s.tenant is NULL' , $ targetTableAlias ) ; } else { $ constraint = sprintf ( '%s.tenant = \'%s\'' , $ targetTableAlias , $ tenant ) ; } return $ constraint ; }
Add a tenant sql condition if the entity is tenantable

@param \Doctrine\ORM\Mapping\ClassMetadata $targetEntity
@param string $targetTableAlias
@return string
Add a tenant sql condition if the entity is tenantable