zachleigh / yarak Goto Github PK
View Code? Open in Web Editor NEWPhalcon devtools
License: MIT License
Phalcon devtools
License: MIT License
I need option to use existing "db" connection. I'm using sqlite in-memory option in my unit tests, in-memory option is not shareable between apps. That's why i have to share my apps db connection with yarak. Here is my workaround in ConnectionResolver class
<?php
namespace Yarak\DB;
use Phalcon\Exception;
use Phalcon\Di;
class ConnectionResolver
{
/**
* Get connection to database.
*
* @param array $dbConfig
*
* @throws Exception
*
* @return \Phalcon\Db\Adapter\Pdo
*/
public function getConnection(array $dbConfig)
{
$di = DI::getDefault();
if($di->has('db'))
return $di->getShared('db');
$dbClass = sprintf('\Phalcon\Db\Adapter\Pdo\%s', $dbConfig['adapter']);
if (!class_exists($dbClass)) {
throw new Exception(
sprintf('PDO adapter "%s" not found.', $dbClass)
);
}
unset($dbConfig['adapter']);
return new $dbClass($dbConfig);
}
}
Hi,
first of all, congratulations for the great work on this package.
The command php yarak make:migration create_users_table --create=users
, present in the readme, does NOT work, since create
is an option and cannot take values.
Instead php yarak make:migration create_users_table --create
works, but it does not set the table name properly.
Please continue to develop Yarak, it can be of great value to the Phalcon community :)
install-phalcon.sh
:
# Temporarilly using zephir for all builds. Once https://github.com/phalcon/cphalcon/issues/11961
# gets fixed we can revert to only PHP7 using zephir.
The phalcon/cphalcon#11961 was fixed
The example provided in the readme
php yarak migrate --refresh --seed --class=SeederName
is wrong. Those options don't exist:
protected $signature = 'make:migration
{name : The name of your migration, words separated by underscores.}
{--c|create : The name of the table to create.}';
Getting the following error when running phpunit:
Yarak\Exceptions\InvalidConfig: The setting 'application -> databaseDir' can not be found. Please be sure it is set.
This is what my phpunit bootstrap file looks like:
<?php
use Phalcon\Di\FactoryDefault;
use Phalcon\Loader;
ini_set("display_errors", 1);
error_reporting(E_ALL);
define("ROOT_PATH", __DIR__);
define("BASE_PATH", __DIR__ . '/../');
define("APP_PATH", BASE_PATH . 'app');
$di = new FactoryDefault();
include APP_PATH . '/config/services.php';
$config = $di->getConfig();
include APP_PATH . '/config/loader.php';
Command should be php yarak view:clear
Should use cacheDir
variable set in config to get directory. Loop through all files, check for vlot.php
extension and remove file.
Hi,
please specify in the readme how to manually run tests, for people who want to contribute:
composer install
codeception.yml
file and /app/config/config.php
filesphp vendor/codeception/codeception/codecept run
Thanks.
Hi there,
Firstly nice work.
Secondly I can't seem to be able to seed my db as the following error occurs...
PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known.
I am running on Docker so my host is my service container name db
.
My application has had no trouble connecting to the database and inserting entries, it's all configured in config.php
.
Config file
Registering DB Service
Registering Yarak Service
Yarak file
Connecting manually seems to work?
try {
$pdo = new \PDO('mysql:host=dev_db;dbname=realworlddb;port=3306;charset=utf8', 'root', 'secret');
$stmt = $pdo->query('SELECT * FROM users');
$result = $stmt->fetchAll();
var_dump($result); exit;
} catch (\Exception $e) {
var_dump($e); exit;
}
UPDATE:
It fails at this line...
https://github.com/zachleigh/yarak/blob/master/src/DB/Factories/ModelFactoryBuilder.php#L148
Though I can run the same type of code in a controller so maybe it's a CLI issue?
Do you know how I can debug this problem?
Thanks
Running console:generate' when no
consoleDir` \value is set results in the following output:
Created commands directory.
PHP Warning: file_put_contents(/Kernel.php): failed to open stream: Permission denied in /home/zachleigh/Web/NewSonohini/vendor/zachleigh/yarak/src/Helpers/Filesystem.php on line 40
Created kernel file.
PHP Warning: file_put_contents(/commands/ExampleCommand.php): failed to open stream: No such file or directory in /home/zachleigh/Web/NewSonohini/vendor/zachleigh/yarak/src/Helpers/Filesystem.php on line 40
Created example command file.
Nothing was actually created. Need to either have a default path or catch this circumstance and throw an appropriate error.
Hi,
since dd() is a very popular Laravel function, many developers (such as me) have defined their own dd() function in Phalcon.
In Unit Tests the Yarak helpers file is called at the very beginning, Yarak's dd() function is always defined before the custom application's dd().
Since I suppose Yarak's dd() is used only for Yarak's development, could you just rename it?
It seems that several tests are failing.
Time: 9.81 seconds, Memory: 20.00MB
There were 12 errors:
Some of them are due to:
[PDOException] SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'password' at row 1
Then there are other 5 failing tests that seem to be more serious. Could you please check and fix them?
Thanks
After running console:generate
, I get the following error:
PHP Fatal error: Uncaught Error: Class 'App\Console\Kernel' not found
The root namespace in the project is not App. Should have a root namespace setting to allow for better namespace guessing.
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.