Skip to content

Commit

Permalink
Merge branch '3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SidRoberts committed Jul 29, 2016
2 parents f86ab82 + b08af04 commit 9cf59db
Show file tree
Hide file tree
Showing 597 changed files with 73,237 additions and 6,999 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ updated when any changes are made to this repository.
You are welcome to fork this repository and add, correct or enhance the
documentation yourselves.

The documentation is written using [reStructuredText](http://sphinx.pocoo.org/rest.html) and is currently available in 9 different languages:
The documentation is written using [reStructuredText](http://sphinx.pocoo.org/rest.html) and is currently available in 10 different languages:

* [English (en)](https://docs.phalconphp.com/en/latest/index.html)
* [Chinese (zh)](https://docs.phalconphp.com/zh/latest/index.html)
* [French (fr)](https://docs.phalconphp.com/fr/latest/index.html)
* [Indonesian (id)](https://docs.phalconphp.com/id/latest/index.html)
* [Japanese (ja)](https://docs.phalconphp.com/ja/latest/index.html)
* [Polish (pl)](https://docs.phalconphp.com/pl/latest/index.html)
* [Portuguese (pt)](https://docs.phalconphp.com/pt/latest/index.html)
Expand Down
2 changes: 0 additions & 2 deletions en/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ API Indice
Phalcon_Db_Adapter
Phalcon_Db_Adapter_Pdo
Phalcon_Db_Adapter_Pdo_Mysql
Phalcon_Db_Adapter_Pdo_Oracle
Phalcon_Db_Adapter_Pdo_Postgresql
Phalcon_Db_Adapter_Pdo_Sqlite
Phalcon_Db_Column
Phalcon_Db_Dialect
Phalcon_Db_Dialect_MySQL
Phalcon_Db_Dialect_Oracle
Phalcon_Db_Dialect_Postgresql
Phalcon_Db_Dialect_Sqlite
Phalcon_Db_Exception
Expand Down
35 changes: 35 additions & 0 deletions en/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,38 @@ The above code produces the following:
)

There are more adapters available for this components in the `Phalcon Incubator <https://github.com/phalcon/incubator>`_

Injecting Configuration Dependency
----------------------------------
You can inject configuration dependency to controller allowing us to use :doc:`Phalcon\\Config <../api/Phalcon_Config>` inside :doc:`Phalcon\\Mvc\\Controller <../api/Phalcon_Mvc_Controller>`. To be able to do that, add following code inside your dependency injector script.

.. code-block:: php
<?php
use Phalcon\Di\FactoryDefault;
use Phalcon\Config;
// Create a DI
$di = new FactoryDefault();
$di->set('config', function () {
$configData = require 'config/config.php';
return new Config($configData);
});
Now in your controller you can access your configuration by using dependency injection feature using name `config` like following code:

.. code-block:: php
<?php
use Phalcon\Mvc\Controller;
class MyController extends Controller
{
private function getDatabaseName()
{
return $this->config->database->dbname;
}
}
26 changes: 0 additions & 26 deletions en/reference/db.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ database engines are supported:
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
| SQLite | SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine | :doc:`Phalcon\\Db\\Adapter\\Pdo\\Sqlite <../api/Phalcon_Db_Adapter_Pdo_Sqlite>` |
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
| Oracle | Oracle is an object-relational database management system produced and marketed by Oracle Corporation. | :doc:`Phalcon\\Db\\Adapter\\Pdo\\Oracle <../api/Phalcon_Db_Adapter_Pdo_Oracle>` |
+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+

Implementing your own adapters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -46,8 +44,6 @@ Phalcon encapsulates the specific details of each database engine in dialects. T
+------------+-----------------------------------------------------+--------------------------------------------------------------------------------+
| SQLite | SQL specific dialect for SQLite database system | :doc:`Phalcon\\Db\\Dialect\\Sqlite <../api/Phalcon_Db_Dialect_Sqlite>` |
+------------+-----------------------------------------------------+--------------------------------------------------------------------------------+
| Oracle | SQL specific dialect for Oracle database system | :doc:`Phalcon\\Db\\Dialect\\Oracle <../api/Phalcon_Db_Dialect_Oracle>` |
+------------+-----------------------------------------------------+--------------------------------------------------------------------------------+

Implementing your own dialects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -106,28 +102,6 @@ below shows how to create a connection passing both required and optional parame
// Create a connection
$connection = new \Phalcon\Db\Adapter\Pdo\Sqlite($config);
.. code-block:: php
<?php
// Basic configuration
$config = array(
'username' => 'scott',
'password' => 'tiger',
'dbname' => '192.168.10.145/orcl'
);
// Advanced configuration
$config = array(
'dbname' => '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=xe)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=20)(DELAY=5))))',
'username' => 'scott',
'password' => 'tiger',
'charset' => 'AL32UTF8'
);
// Create a connection
$connection = new \Phalcon\Db\Adapter\Pdo\Oracle($config);
Setting up additional PDO options
---------------------------------
You can set PDO options at connection time by passing the parameters 'options':
Expand Down
26 changes: 24 additions & 2 deletions en/reference/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,32 @@ And use this class instead of the anonymous function:
<?php
$router->add('/get/info/{id}', array(
$router->add('/get/info/{id}', [
'controller' => 'products',
'action' => 'info'
))->beforeMatch(array(new AjaxFilter(), 'check'));
])->beforeMatch([new AjaxFilter(), 'check']);
Since Phalcon 2.1.0 beta 1, there is another way to check this:

.. code-block:: php
<?php
$router->add('/login', [
'module' => 'admin',
'controller' => 'session'
])->beforeMatch(function ($uri, $route) {
/**
* @var string $uri
* @var \Phalcon\Mvc\Router\Route $route
* @var \Phalcon\DiInterface $this
* @var \Phalcon\Http\Request $request
*/
$request = $this->getShared('request');
// Check if the request was made with Ajax
return $request->isAjax();
});
Hostname Constraints
--------------------
Expand Down
Loading

0 comments on commit 9cf59db

Please sign in to comment.