public function getQueryReference($key = '', $foreign = '', $foreignLabel = '', $foreignKey = '', &$i)
    {
        $model      = Norm::factory($foreign);
        $refSchemes = $model->schema();
        $foreignKey = $foreignKey ?: 'id';

        if ($foreignKey == '$id') {
            $foreignKey = 'id';
        }

        $query = $key . ' IN (SELECT '.$foreignKey.' FROM '.strtolower($foreign).' WHERE '.$foreignLabel.' LIKE :f'.$i.') ';
        $i++;

        return $query;
    }
public function getQueryReference($key = '', $foreign = '', $foreignLabel = '', $foreignKey = '', &$i)
    {
        $model      = Norm::factory($foreign);
        $refSchemes = $model->schema();
        $foreignKey = $foreignKey ?: 'id';

        if ($foreignKey == '$id') {
            $foreignKey = 'id';
        }

        $query = $key . ' IN (SELECT '.$foreignKey.' FROM '.strtolower($foreign).' WHERE '.$foreignLabel.' LIKE :f'.$i.') ';
        $i++;

        return $query;
    }
public function getQueryReference ( $ key = '' , $ foreign = '' , $ foreignLabel = '' , $ foreignKey = '' , & $ i ) { $ model = Norm :: factory ( $ foreign ) ; $ refSchemes = $ model -> schema ( ) ; $ foreignKey = $ foreignKey ? : 'id' ; if ( $ foreignKey == '$id' ) { $ foreignKey = 'id' ; } $ query = $ key . ' IN (SELECT ' . $ foreignKey . ' FROM ' . strtolower ( $ foreign ) . ' WHERE ' . $ foreignLabel . ' LIKE :f' . $ i . ') ' ; $ i ++ ; return $ query ; }
Find reference of a foreign key.

@param string $key
@param string $foreign
@param string $foreignLabel
@param string $foreignKey
@param int &$i

@return string
Find reference of a foreign key .