Giter Site home page Giter Site logo

yarak's People

Contributors

micheleangioni avatar sergeyklay avatar zachleigh 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

yarak's Issues

Possibility to use existing "db" instead opening new one

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);
    }
}

make:migration create option does NOT take the name of the table

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 :)

The --refresh and --seed options don't exist in migrate command

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.}';

Unable to detect 'databaseDir' from config when using factory function in phpunit test

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';

Add view cache clear command

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.

Specify how to manually run tests

Hi,
please specify in the readme how to manually run tests, for people who want to contribute:

  1. Run composer install
  2. Specify a correct user/password in the codeception.yml file and /app/config/config.php files
  3. Run php vendor/codeception/codeception/codecept run

Thanks.

PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known.

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.

Trace image

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

If consoleDir not set, get PHP warnings but no exception or helpful message

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.

Consider renaming dd()

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?

Several failing tests

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

namespace problems uncaught

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.

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.