yii2tech / filedb Goto Github PK
View Code? Open in Web Editor NEWActiveRecord for static data definitions based on files
License: Other
ActiveRecord for static data definitions based on files
License: Other
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.
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.
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.
ActiveRecord::indexBy()
does not apply in case Yii framework version 2.0.14 (2.0.14.1) is used.
Issue is caused by PR:
yiisoft/yii2#13891
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
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));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.