Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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