GithubHelp home page GithubHelp logo

yii2tech / filedb Goto Github PK

View Code? Open in Web Editor NEW
73.0 14.0 12.0 59 KB

ActiveRecord for static data definitions based on files

License: Other

PHP 100.00%
yii yii2 yii2-extension activerecord filedb localstorage

filedb's People

Contributors

fps01 avatar jacmoe avatar klimov-paul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filedb's Issues

Error using yii2tech\filedb\Query;

If i use \yii2tech\filedb\ActiveRecord it is work fine.

But yii2tech\filedb\Query exit with error:
Call to a member function getQueryProcessor() on null
in D:\Data\OpenServer\5.2.4\domains\site.my\vendor\yii2tech\filedb\Query.php at line 110

Controller:

<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;

use yii2tech\filedb\Query;

class SiteController extends Controller
{

    public $layout = 'web';

    public function actionIndex()
    {
        //$items = Items::find()->all(); // <-- It is work fine!
        $query = new Query();
        $query->from('Items');
        $rows = $query->all(); // <-- Error!

        return $this->render('index', ['items' => $items]);
    }

    public function actionAbout()
    {
        return $this->render('about');
    }

}

filedb file (@app/data/Items.php):

<?php

return [
    1 => [
        'name' => 'admin',
        'description' => 'Site administrator',
    ],
    2 => [
        'name' => 'member',
        'description' => 'Registered front-end user',
    ],
];

Yii2 config:

//...
 'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => require(__DIR__ . '/db.php'),
        'filedb' => [
            'class' => 'yii2tech\filedb\Connection',
            'path' => '@app/data',
        ],
    ],
    'params' => $params,
//...

Did everything according to Your documentation.

Add `callback` condition processing

For the maximum query flexibility there should be an ability to setup PHP callback, which will filter the result records.
Can be specified for the whole row or per particular attribute.

Add `contains` condition processing

Some fields may conatain array as data, for example:

[
    1 => [
        'name' => 'foo',
        'categoryIds' => [
            1,
            2,
            3,
        ],
    ],
];

The should be ability to query rows, which holds some value inside array-type attribute.

Keys contains and not contains can be used for such kind of conditions.

missing ActiveQuery::getTableNameAndAlias() method

I get the following error:
Calling unknown method: yii2tech\filedb\ActiveQuery::getTableNameAndAlias()

I use yii 2.0.13.1
The implementatio is as follow

$gettoni = AgentePagamentoGettone::find()->where($filter)->joinWith('tipoFornitura')->all();

tipoFornitura relation is as follow TipoFornitura is filedb and contratto is a mysql table

    public function getTipoFornitura()
    {
        return $this->hasMany(TipoFornitura::className(), ['id' => 'tipoFornitura_id'])
            ->via('contratto');
    }

Dunno if you need more info but looking at the file but getTableNameAndAlias is simply missing

Unable to perform compare filtering

QueryProcessor is unable to perform comparison via operators like <, > and so on.
Any attempt of usage causes UnknownMethodException: 'Calling unknown method: yii2tech\filedb\QueryProcessor::filterSimpleCondition()'

Unit test to reproduce:

$query = new Query();
$rows = $query->from('customer')
    ->where(['>', 'status', 5])
    ->all($connection);
$this->assertEquals(5, count($rows));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.