public function inCompanies(array $req_companies)
    {
        $companies = new ArrayCollection();

        foreach ($req_companies as $company) {
            if ($company = trim($company) === '') {
                continue;
            }
            if ($companies->contains($company)) {
                continue;
            }
            $companies->add($company);
        }

        if (!$companies->isEmpty()) {
            $this->companies = $companies;
        }

        return $this;
    }
public function inCompanies(array $req_companies)
    {
        $companies = new ArrayCollection();

        foreach ($req_companies as $company) {
            if ($company = trim($company) === '') {
                continue;
            }
            if ($companies->contains($company)) {
                continue;
            }
            $companies->add($company);
        }

        if (!$companies->isEmpty()) {
            $this->companies = $companies;
        }

        return $this;
    }
public function inCompanies ( array $ req_companies ) { $ companies = new ArrayCollection ( ) ; foreach ( $ req_companies as $ company ) { if ( $ company = trim ( $ company ) === '' ) { continue ; } if ( $ companies -> contains ( $ company ) ) { continue ; } $ companies -> add ( $ company ) ; } if ( ! $ companies -> isEmpty ( ) ) { $ this -> companies = $ companies ; } return $ this ; }
Restrict users by companies

@param array $req_companies

@return $this
Restrict users by companies