Download the PHP package emiliomg/propel-provider-behavior without Composer

On this page you can find all versions of the php package emiliomg/propel-provider-behavior. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package propel-provider-behavior

Propel Provider Behavior

A Propel ORM Behavior that provides you with Providers for Query/Model/Peer Objects.

Requirements

Install

Add this behavior to your project via your composer.json file

"require": {
    "emiliomg/propel-provider-behavior": "~1.0"
}

Or simply run composer require emiliomg/propel-provider-behavior.

Then, add the following configuration to your build.properties:

propel.behavior.providerBase.behavior = vendor.emiliomg.propel-provider-behavior.src.ProviderBaseBehavior.ProviderBaseBehavior
propel.behavior.providerFassade.behavior = vendor.emiliomg.propel-provider-behavior.src.ProviderFassadeBehavior.ProviderFassadeBehavior
propel.behavior.default = providerBase, providerFassade

The propel.behavior.default makes sure every one of your models uses this behavior.

Finally, rebuild your models. The provider classes will be generated alongside you Models and Query-Classes.

Configuration

You can use the propel.behavior.provider.cachefile = true switch. This will generate a providerCache.json file inside the outputDir which contains a list of all generated Providers. This can be useful, e.g. for automatically generating factories (which the Symfony2 Bundle does for you automatically).

Generated code

The generated provider code is quite simple. We use a simple schema.xml like this

<?xml version="1.0" encoding="utf-8"?>
<database name="bookstore" defaultIdMethod="native" namespace="Foo\Bar\Model">
    <table name="Author" idMethod="native">
        <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
        <column name="name" type="VARCHAR" size="255" required="false"/>
        <vendor type="mysql">
            <parameter name="Engine" value="InnoDB"/>
        </vendor>
    </table>
</database>

A sample output for a ficional Author-Model then looks like this:

BaseAuthorProvider

<?php

namespace Foo\Bar\Model\om;

use \Propel;
use Foo\Bar\Model\Author;
use Foo\Bar\Model\AuthorPeer;
use Foo\Bar\Model\AuthorQuery;

/**
 * This is a provider base class for the 'Author' table.
 * It provides query, model, peer and connection instances.
 * You can use Dependency Injection to inject this provider into services who need
 * 'Author'-queries or -models and fetch them via this provider.
 * There is no need to access the models or queries directly, since this provider can be mocked.
 */
abstract class BaseAuthorProvider
{
    /**
     * Returns a new query instance.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param   AuthorQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return AuthorQuery
     */
    public function getQuery($modelAlias = null, $criteria = null)
    {
        $query = AuthorQuery::create($modelAlias, $criteria);

        return $query;
    }

    /**
     * Returns a new Model instance.
     *
     * @return Author
     */
    public function getModel()
    {
        $model = new Author();

        return $model;
    }

    /**
     * Returns a new Peer Instance;
     *
     * @return AuthorPeer
     */
    public function getPeer()
    {
        $peer = new AuthorPeer();

        return $peer;
    }

    /**
     * Returns the connection for this table.
     *
     * @return \PropelPDO
     */
    public function getConnection()
    {
        $peer = $this->getPeer();
        $connection = Propel::getConnection($peer::DATABASE_NAME);

        return $connection;
    }

}

AuthorProvider

The behaviors also generate fassade classes, which will be generated if and only if there is no fassade class already present. A fassade class looks like this:

<?php

namespace Foo\Bar\Model;

use Foo\Bar\Model\om\BaseAuthorProvider;

/**
 * This is a provider fassade class for the 'Author' table.
 * It provides query, model, peer and connection instances.
 * You can use Dependency Injection to inject this provider into services who need
 * 'Author'-queries or -models and fetch them via this provider.
 * There is no need to access the models or queries directly, since this provider can be mocked.
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 */
class AuthorProvider extends BaseAuthorProvider
{

}

All versions of propel-provider-behavior with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
propel/propel1 Version ~1.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package emiliomg/propel-provider-behavior contains the following files

Loading the files please wait ...