tigrov / yii2-pgsql Goto Github PK
View Code? Open in Web Editor NEWImproved PostgreSQL schemas for Yii2
License: MIT License
Improved PostgreSQL schemas for Yii2
License: MIT License
Обновление сломало работу расширения с ошибкой:
Declaration of tigrov\\pgsql\\QueryBuilder::batchInsert($table, $columns, $rows) should be compatible with yii\\db\\pgsql\\QueryBuilder::batchInsert($table, $columns, $rows, &$params = Array)
Hi.
When using your extension together with yii2-queue - it breaks because it uses bit field in an old manner (asumes PHP type to be an integer). I very much need your extension for Array and JSON fields, but other type conversions often make mess with other extensions and standard framework functionality. Could you, please, make a separate Shema class which would only handle Array and JSON types, and leave other's behavior untouched?
DateTime::__construct(): Failed to parse time string (to_date('01.01.9999') at position 0 (t): The timezone could not be found in the database
/var/www/api.is74.ru/vendor/tigrov/yii2-pgsql/src/ColumnSchema.php in __construct at line 135
...
return json_decode($value, true);
case Schema::TYPE_TIMESTAMP:
case Schema::TYPE_TIME:
case Schema::TYPE_DATE:
case Schema::TYPE_DATETIME:
/* Тут стоит перехватывать исключения, потому что выражения бывают несколько сложнее, чем просто текущее время.
Бывает дата прописана, бывает прописывается текущее время со сдвигом вперед.
В случае если не удалось разобрать строку, то вернуть NULL.
I think here need to add try-catch. Parser can't parse some expressions and we have an exception. But we can catch exception and set NULL value for column in this case. Now we need change default value in database although this is valid expression for database.
*/
return new \DateTime($value);
case Schema::TYPE_COMPOSITE:
return $this->phpTypecastComposite($value);
}
return $this->typecast($value);
Каким образом можно использовать обьект DateTime в формах?
<?= $form->field($model, 'from_date')->widget(\yii\jui\DatePicker::classname(), [ 'dateFormat' => 'yyyy-MM-dd', ]) ?>
Ошибка
Object of class DateTime could not be converted to string
Если создать материализованную вьюху(да и наверно просто вьюху) на основе таблицы с массивом композитного поля(some_type[]) - то при формировании модели это поле получается в виде строки.
Not work save to db from model, that was created from this type on select from db.
$newModel = Product::findOne($model->id);
$newModel->price; // is new Money(['value' => 10, 'currency_code' => 'USD'])
$newModel->price->value = 20;
$model->save(); - not work. In db still value = 10.
But your exemple with new model works fine:
$newModel = Product::findOne($model->id);
$model->price = new Money([
'value' => 10,
'currency_code' => 'USD'
]);
$model->save();
This is a very useful library. But the PHP version restrictions do not allow me to use in my application. Can you reduce the requirements in the composter?
Hello.
Your package is awesome!
But I found bug when try to execute migration
Exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (NULL::timestamp without time zone) at position 0 (N): The timezone could not be found in the database'
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.