private function getBelongTo(): array
    {
        $result = [];

        if (! isset($this->capabilities['action'][Utils::getTypeBelongs()])) {
            return $result;
        }

        $table = TableRegistry::getTableLocator()->get('RolesCapabilities.Capabilities');
        Assert::isInstanceOf($table, CapabilitiesTable::class);

        $groups = $table->getUserGroups($this->user['id']);
        // check user capabilities against action's belongs capabilities
        foreach ($this->capabilities['action'][Utils::getTypeBelongs()] as $capability) {
            if (in_array($capability->getName(), $this->capabilities['user'])) {
                // if user has owner capability for current action add appropriate conditions to where clause
                $result[$this->table->aliasField($capability->getField()) . ' IN'] = array_keys($groups);
            }
        }

        return $result;
    }
private function getBelongTo(): array
    {
        $result = [];

        if (! isset($this->capabilities['action'][Utils::getTypeBelongs()])) {
            return $result;
        }

        $table = TableRegistry::getTableLocator()->get('RolesCapabilities.Capabilities');
        Assert::isInstanceOf($table, CapabilitiesTable::class);

        $groups = $table->getUserGroups($this->user['id']);
        // check user capabilities against action's belongs capabilities
        foreach ($this->capabilities['action'][Utils::getTypeBelongs()] as $capability) {
            if (in_array($capability->getName(), $this->capabilities['user'])) {
                // if user has owner capability for current action add appropriate conditions to where clause
                $result[$this->table->aliasField($capability->getField()) . ' IN'] = array_keys($groups);
            }
        }

        return $result;
    }
private function getBelongTo ( ) : array { $ result = [ ] ; if ( ! isset ( $ this -> capabilities [ 'action' ] [ Utils :: getTypeBelongs ( ) ] ) ) { return $ result ; } $ table = TableRegistry :: getTableLocator ( ) -> get ( 'RolesCapabilities.Capabilities' ) ; Assert :: isInstanceOf ( $ table , CapabilitiesTable :: class ) ; $ groups = $ table -> getUserGroups ( $ this -> user [ 'id' ] ) ; // check user capabilities against action's belongs capabilities foreach ( $ this -> capabilities [ 'action' ] [ Utils :: getTypeBelongs ( ) ] as $ capability ) { if ( in_array ( $ capability -> getName ( ) , $ this -> capabilities [ 'user' ] ) ) { // if user has owner capability for current action add appropriate conditions to where clause $ result [ $ this -> table -> aliasField ( $ capability -> getField ( ) ) . ' IN' ] = array_keys ( $ groups ) ; } } return $ result ; }
Return belong to statement.

@return mixed[]
Return belong to statement .