Skip to content

Commit

Permalink
Merge pull request phalcon-orphanage#964 from niden/master
Browse files Browse the repository at this point in the history
3.1.1 API
  • Loading branch information
niden authored Mar 25, 2017
2 parents 1ef3249 + 36719bc commit 1ffc5d1
Show file tree
Hide file tree
Showing 242 changed files with 6,963 additions and 88 deletions.
57 changes: 56 additions & 1 deletion en/api/Phalcon_Cli_Dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,46 @@ Returns value returned by the latest dispatched action



public **setModelBinding** (*boolean* $value) inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`
public **setModelBinding** (*mixed* $value, [*mixed* $cache]) inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`

Enable/Disable model binding during dispatch

.. code-block:: php
<?php
$di->set('dispatcher', function() {
$dispatcher = new Dispatcher();
$dispatcher->setModelBinding(true, 'cache');
return $dispatcher;
});
public **setModelBinder** (:doc:`Phalcon\\Mvc\\Model\\BinderInterface <Phalcon_Mvc_Model_BinderInterface>` $modelBinder, [*mixed* $cache]) inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`

Enable model binding during dispatch

.. code-block:: php
<?php
$di->set('dispatcher', function() {
$dispatcher = new Dispatcher();
$dispatcher->setModelBinder(new Binder(), 'cache');
return $dispatcher;
});
public **getModelBinder** () inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`

Gets model binder



public *object* **dispatch** () inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`
Expand Down Expand Up @@ -308,6 +344,25 @@ Possible class name that will be located to dispatch the request



public **getBoundModels** () inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`

Returns bound models from binder instance

.. code-block:: php
<?php
class UserController extends Controller
{
public function showAction(User $user)
{
$boundModels = $this->dispatcher->getBoundModels(); // return array with $user
}
}
protected **_resolveEmptyProperties** () inherited from :doc:`Phalcon\\Dispatcher <Phalcon_Dispatcher>`

Set empty properties to their defaults (where defaults are available)
Expand Down
6 changes: 6 additions & 0 deletions en/api/Phalcon_Db_Dialect_Mysql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Generates SQL to create a table



public **truncateTable** (*mixed* $tableName, *mixed* $schemaName)

Generates SQL to truncate a table



public **dropTable** (*mixed* $tableName, [*mixed* $schemaName], [*mixed* $ifExists])

Generates SQL to drop a table
Expand Down
6 changes: 6 additions & 0 deletions en/api/Phalcon_Db_Dialect_Postgresql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Generates SQL to create a table



public **truncateTable** (*mixed* $tableName, *mixed* $schemaName)

Generates SQL to truncate a table



public **dropTable** (*mixed* $tableName, [*mixed* $schemaName], [*mixed* $ifExists])

Generates SQL to drop a table
Expand Down
6 changes: 6 additions & 0 deletions en/api/Phalcon_Db_Dialect_Sqlite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Generates SQL to create a table



public **truncateTable** (*mixed* $tableName, *mixed* $schemaName)

Generates SQL to truncate a table



public **dropTable** (*mixed* $tableName, [*mixed* $schemaName], [*mixed* $ifExists])

Generates SQL to drop a table
Expand Down
27 changes: 27 additions & 0 deletions en/api/Phalcon_Db_Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ Allows to define indexes to be used on tables. Indexes are a common way
to enhance database performance. An index allows the database server to find
and retrieve specific rows much faster than it could do without an index

.. code-block:: php
<?php
// Define new unique index
$index_unique = new \Phalcon\Db\Index(
'column_UNIQUE',
[
'column',
'column'
],
'UNIQUE'
);
// Define new primary index
$index_primary = new \Phalcon\Db\Index(
'PRIMARY',
[
'column'
]
);
// Add index to existing table
$connection->addIndex("robots", null, $index_unique);
$connection->addIndex("robots", null, $index_primary);
Methods
-------
Expand Down
57 changes: 56 additions & 1 deletion en/api/Phalcon_Dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,46 @@ Returns value returned by the latest dispatched action



public **setModelBinding** (*boolean* $value)
public **setModelBinding** (*mixed* $value, [*mixed* $cache])

Enable/Disable model binding during dispatch

.. code-block:: php
<?php
$di->set('dispatcher', function() {
$dispatcher = new Dispatcher();
$dispatcher->setModelBinding(true, 'cache');
return $dispatcher;
});
public **setModelBinder** (:doc:`Phalcon\\Mvc\\Model\\BinderInterface <Phalcon_Mvc_Model_BinderInterface>` $modelBinder, [*mixed* $cache])

Enable model binding during dispatch

.. code-block:: php
<?php
$di->set('dispatcher', function() {
$dispatcher = new Dispatcher();
$dispatcher->setModelBinder(new Binder(), 'cache');
return $dispatcher;
});
public **getModelBinder** ()

Gets model binder



public *object* **dispatch** ()
Expand Down Expand Up @@ -228,6 +264,25 @@ public **callActionMethod** (*mixed* $handler, *mixed* $actionMethod, [*array*
...


public **getBoundModels** ()

Returns bound models from binder instance

.. code-block:: php
<?php
class UserController extends Controller
{
public function showAction(User $user)
{
$boundModels = $this->dispatcher->getBoundModels(); // return array with $user
}
}
protected **_resolveEmptyProperties** ()

Set empty properties to their defaults (where defaults are available)
Expand Down
2 changes: 1 addition & 1 deletion en/api/Phalcon_Loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Returns the class-map currently registered in the autoloader



public **register** ()
public **register** ([*mixed* $prepend])

Register the autoload method

Expand Down
45 changes: 44 additions & 1 deletion en/api/Phalcon_Mvc_Collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Constants

*integer* **OP_DELETE**

*integer* **DIRTY_STATE_PERSISTENT**

*integer* **DIRTY_STATE_TRANSIENT**

*integer* **DIRTY_STATE_DETACHED**

Methods
-------

Expand Down Expand Up @@ -172,7 +178,7 @@ Executes internal events after save a document



protected **validate** (:doc:`Phalcon\\Mvc\\Model\\ValidatorInterface <Phalcon_Mvc_Model_ValidatorInterface>` $validator)
protected **validate** (*mixed* $validator)

Executes validators on every validation call

Expand All @@ -186,6 +192,7 @@ Executes validators on every validation call
{
public function validation()
{
// Old, deprecated syntax, use new one below
$this->validate(
new ExclusionIn(
[
Expand All @@ -201,6 +208,30 @@ Executes validators on every validation call
}
}
.. code-block:: php
<?php
use Phalcon\Validation\Validator\ExclusionIn as ExclusionIn;
use Phalcon\Validation;
class Subscriptors extends \Phalcon\Mvc\Collection
{
public function validation()
{
$validator = new Validation();
$validator->add("status",
new ExclusionIn(
[
"domain" => ["A", "I"]
]
)
);
return $this->validate($validator);
}
}
Expand Down Expand Up @@ -548,6 +579,18 @@ Deletes a model instance. Returning true on success or false otherwise.
public **setDirtyState** (*mixed* $dirtyState)

Sets the dirty state of the object using one of the DIRTY_STATE_* constants



public **getDirtyState** ()

Returns one of the DIRTY_STATE_* constants telling if the document exists in the collection or not



protected **addBehavior** (:doc:`Phalcon\\Mvc\\Collection\\BehaviorInterface <Phalcon_Mvc_Collection_BehaviorInterface>` $behavior)

Sets up a behavior in a collection
Expand Down
10 changes: 10 additions & 0 deletions en/api/Phalcon_Mvc_CollectionInterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ abstract public **getConnection** ()
...


abstract public **setDirtyState** (*mixed* $dirtyState)

...


abstract public **getDirtyState** ()

...


abstract public static **cloneResult** (:doc:`Phalcon\\Mvc\\CollectionInterface <Phalcon_Mvc_CollectionInterface>` $collection, *array* $document)

...
Expand Down
Loading

0 comments on commit 1ffc5d1

Please sign in to comment.