Giter Club home page Giter Club logo

php_propel_behavior_entity_instantiator's People

Contributors

stevleibelt avatar tworzenieweb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

php_propel_behavior_entity_instantiator's Issues

Add option to configure a default connection in getConnection

When a class is generated, the method "getConnection" looks like the following.

    /**
     * @param null|string $name - The data source name that is used to look up the DSN from the runtime configuration file.
     * @param string $mode The connection mode (this applies to replication systems).
     * @return PDO
     */
    public function getConnection($name = null, $mode = Propel::CONNECTION_WRITE)
    {
        return Propel::getConnection($name, $mode);
    }

It can happen that you are using multiple databases resulting in multiple generated classes.
To still be able to get the right connection without passing around the name, it would be good to configure the default name. If the default name is configured, the generated method could look like that.

    /**
     * @param null|string $name - The data source name that is used to look up the DSN from the runtime configuration file.
     * @param string $mode The connection mode (this applies to replication systems).
     * @return PDO
     */
    public function getConnection($name = null, $mode = Propel::CONNECTION_WRITE)
    {
        if (is_null($name)) {
            $name = 'my_configured_default_value';
        }

        return Propel::getConnection($name, $mode);
    }

The same could be done for the value "$mode".

It would be nice to generate with full qualified names an no use statements

Instead of

use Foo\Bar\Baz;

class FooLocator
{
    public function createBaz()
    {
        return Baz::create();
    }
}

it would be nice to generate something like this:

class FooLocator
{
    public function createBaz()
    {
        return \Foo\Bar\Baz::create();
    }
}

The reason is an available php bug when running php in cli mode with opcache enabled that is throwing fatal errors for all situations where a classname conflict can happen.
The bug can be triggered using this code snippets.

What about adding another configuration value like:

<paramater name="entity_instantiator_use_fully_qualified_name" value="true|false" />

If it is set to true, all the code has to do is if the classes are in the same namespace like the generator. If not, we can use the fully qualified name.

Consider migrating Travis CI to GitHub Action

As title, it seems that the Travis CI has been slow and unstable. And it's the third party service.

Since the GitHub Action has been released, I think it's time to migrate the Travis CI to GitHub Action.

Once this issue is accepted by @stevleibelt, I will be happy to work on this :).

@author is to long

When I create a file, I get something like thins in the comments.

/**
 * Class <file name>
 *
 * @author Net\Bazzline\Propel\Behavior\EntityInstantiatorNet\Bazzline\Propel\Behavior\EntityInstantiator\FileContentGenerator
 * @since 2015-11-24
 * @see http://www.bazzline.net
 */

I don't think that this is expected ;-).

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.