Skip to content

Commit

Permalink
Document specific query builder functions (#2318)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Peveler <[email protected]>
  • Loading branch information
MarwanSalim and MasterOdin authored Oct 17, 2024
1 parent 31d837c commit efd7cf8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/en/migrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,34 @@ be easy to work with as it resembles very closely plain SQL. Accesing the query
}
}
Alternatively, the following methods are available to enhance code organization and improve clarity:

* ``getSelectBuilder()``: Returns a SelectQuery object for building SELECT statements.
* ``getInsertBuilder()``: Returns an InsertQuery object for building INSERT statements.
* ``getUpdateBuilder()``: Returns an UpdateQuery object for building UPDATE statements.
* ``getDeleteBuilder()``: Returns a DeleteQuery object for building DELETE statements.


.. code-block:: php
<?php
use Phinx\Migration\AbstractMigration;
class MyNewMigration extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$builder = $this->getSelectBuilder();
$statement = $builder->select('*')->from('users')->execute();
var_dump($statement->fetchAll());
}
}
Selecting Fields
~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit efd7cf8

Please sign in to comment.