2017 © Pedro Peláez
 

yii2-extension yii2-condition-builder-client

Yii2 Client condition builder

image

studxxx/yii2-condition-builder-client

Yii2 Client condition builder

  • Friday, May 25, 2018
  • by studxxx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 204 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 41 % Grown

The README.md

yii2-condition-builder-client

version ![Latest Version][latest-version-badge] License: MIT ![Total Downloads][total-downloads-badge] , (*1)

It's a specific library which, based on constructor conditions and data to compare, performs data filtering according to given conditions, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist studxxx/yii2-condition-builder-client "*"

or add, (*5)

"studxxx/yii2-condition-builder-client": "*"

to the require section of your composer.json file., (*6)

Setup

Into config file, (*7)

<?php
return [
    // ...
    'container' => [
        'definitions' => [
            'studxxx\conditionclient\ConditionBuilderInterface' =>
                'studxxx\conditionclient\ConditionBuilder',
        ]
    ]
];

Condiction format

<php
return [
    "conditions" => [
        [
            "operator" => "AND",
            "conditions" => [
                [
                    "operator" => "NOT",
                    "conditions" => [
                        [
                            "attribute" => "items.price_variant",
                            "comparison" => "in",
                            "value" => [
                                "exclusive",
                                "buyout"
                            ],
                        ]
                    ]
                ],
                [
                    "attribute" => "items.namespace",
                    "comparison" => "=",
                    "value" => "products",
                ],
                [
                    "attribute" => "project",
                    "comparison" => "=",
                    "value" => "TM",
                }
            ]
        ]
    ],
];
<?php

namespace api\modules\api\v2\services;

use studxxx\conditionclient\ConditionBuilderInterface;

class DiscountService implements DiscountServiceInterface
{
    /** @var ConditionBuilderInterface */
    private $conditionBuilder;

    public function __construct(ConditionBuilderInterface $conditionBuilder)
    {
        $this->conditionBuilder = $conditionBuilder;
    }

    public function applicability(ConditionQuery $query, string $code, array $params = []): array
    {
        /** @var array $condition */
        $condition = $this->getCondition($query, $code);

        $this->conditionBuilder->setData($params);
        return $this->conditionBuilder->buildConditions($condition)->getData();
    }
}

The Versions

25/05 2018

dev-develop

dev-develop

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

25/05 2018

dev-master

9999999-dev

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

25/05 2018

0.0.6

0.0.6.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

21/05 2018

0.0.5

0.0.5.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

11/05 2018

0.0.4

0.0.4.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

11/05 2018

dev-feature/unitTestsOperators

dev-feature/unitTestsOperators

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

03/05 2018

0.0.3

0.0.3.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

03/05 2018

0.0.2

0.0.2.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

02/05 2018

0.0.1

0.0.1.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder

27/04 2018

0.0.0

0.0.0.0

Yii2 Client condition builder

  Sources   Download

MIT

The Requires

 

The Development Requires

by Valentyn Studynytskiy

yii2 condition builder