src/FreeFW/Storage/PDOStorage.php
protected function renderCondition(\FreeFW\Model\Condition $p_condition)
    {
        $result = [];
        $left   = $p_condition->getLeftMember();
        $right  = $p_condition->getRightMember();
        $oper   = $p_condition->getOperator();
        switch ($oper) {
            case \FreeFW\Storage\Storage::COND_LOWER:
            case \FreeFW\Storage\Storage::COND_LOWER_EQUAL:
            case \FreeFW\Storage\Storage::COND_GREATER:
            case \FreeFW\Storage\Storage::COND_GREATER_EQUAL:
            case \FreeFW\Storage\Storage::COND_EQUAL:
                if ($left !== null && $right !== null) {
                    $leftDatas  = $this->renderConditionField($left);
                    $rightDatas = $this->renderConditionField($right);
                    $result = [
                        'sql'    => $leftDatas['id'] . ' ' . $oper . ' ' . $rightDatas['id'],
                        'values' => [],
                        'type'   => false
                    ];
                    if ($leftDatas['type'] === false) {
                        $result['values'][$leftDatas['id']] = $leftDatas['value'];
                    } else {
                        $result['type'] = $leftDatas['type'];
                    }
                    if ($rightDatas['type'] === false) {
                        $result['values'][$rightDatas['id']] = $rightDatas['value'];
                    } else {
                        $result['type'] = $rightDatas['type'];
                    }
                } else {
                    throw new \FreeFW\Core\FreeFWStorageException(
                        sprintf('Wrong fields for %s condition', $oper)
                    );
                }
                break;
            default:
                throw new \FreeFW\Core\FreeFWStorageException(
                    sprintf('Unknown condition : %s !', $oper)
                );
                break;
        }
        return $result;
    }
protected function renderCondition(\FreeFW\Model\Condition $p_condition)
    {
        $result = [];
        $left   = $p_condition->getLeftMember();
        $right  = $p_condition->getRightMember();
        $oper   = $p_condition->getOperator();
        switch ($oper) {
            case \FreeFW\Storage\Storage::COND_LOWER:
            case \FreeFW\Storage\Storage::COND_LOWER_EQUAL:
            case \FreeFW\Storage\Storage::COND_GREATER:
            case \FreeFW\Storage\Storage::COND_GREATER_EQUAL:
            case \FreeFW\Storage\Storage::COND_EQUAL:
                if ($left !== null && $right !== null) {
                    $leftDatas  = $this->renderConditionField($left);
                    $rightDatas = $this->renderConditionField($right);
                    $result = [
                        'sql'    => $leftDatas['id'] . ' ' . $oper . ' ' . $rightDatas['id'],
                        'values' => [],
                        'type'   => false
                    ];
                    if ($leftDatas['type'] === false) {
                        $result['values'][$leftDatas['id']] = $leftDatas['value'];
                    } else {
                        $result['type'] = $leftDatas['type'];
                    }
                    if ($rightDatas['type'] === false) {
                        $result['values'][$rightDatas['id']] = $rightDatas['value'];
                    } else {
                        $result['type'] = $rightDatas['type'];
                    }
                } else {
                    throw new \FreeFW\Core\FreeFWStorageException(
                        sprintf('Wrong fields for %s condition', $oper)
                    );
                }
                break;
            default:
                throw new \FreeFW\Core\FreeFWStorageException(
                    sprintf('Unknown condition : %s !', $oper)
                );
                break;
        }
        return $result;
    }
protected function renderCondition ( \ FreeFW \ Model \ Condition $ p_condition ) { $ result = [ ] ; $ left = $ p_condition -> getLeftMember ( ) ; $ right = $ p_condition -> getRightMember ( ) ; $ oper = $ p_condition -> getOperator ( ) ; switch ( $ oper ) { case \ FreeFW \ Storage \ Storage :: COND_LOWER : case \ FreeFW \ Storage \ Storage :: COND_LOWER_EQUAL : case \ FreeFW \ Storage \ Storage :: COND_GREATER : case \ FreeFW \ Storage \ Storage :: COND_GREATER_EQUAL : case \ FreeFW \ Storage \ Storage :: COND_EQUAL : if ( $ left !== null && $ right !== null ) { $ leftDatas = $ this -> renderConditionField ( $ left ) ; $ rightDatas = $ this -> renderConditionField ( $ right ) ; $ result = [ 'sql' => $ leftDatas [ 'id' ] . ' ' . $ oper . ' ' . $ rightDatas [ 'id' ] , 'values' => [ ] , 'type' => false ] ; if ( $ leftDatas [ 'type' ] === false ) { $ result [ 'values' ] [ $ leftDatas [ 'id' ] ] = $ leftDatas [ 'value' ] ; } else { $ result [ 'type' ] = $ leftDatas [ 'type' ] ; } if ( $ rightDatas [ 'type' ] === false ) { $ result [ 'values' ] [ $ rightDatas [ 'id' ] ] = $ rightDatas [ 'value' ] ; } else { $ result [ 'type' ] = $ rightDatas [ 'type' ] ; } } else { throw new \ FreeFW \ Core \ FreeFWStorageException ( sprintf ( 'Wrong fields for %s condition' , $ oper ) ) ; } break ; default : throw new \ FreeFW \ Core \ FreeFWStorageException ( sprintf ( 'Unknown condition : %s !' , $ oper ) ) ; break ; } return $ result ; }
Render a full condition

@param \FreeFW\Model\Condition $p_condition

@throws \FreeFW\Core\FreeFWStorageException
Render a full condition