Skip to content

Conversation

@ajibarra
Copy link
Member

@ajibarra ajibarra commented May 24, 2024

Fixes #2271

@MasterOdin MasterOdin changed the title 2271 - Update docs for 0.16.x Update docs for 0.16.x Jun 3, 2024
@MasterOdin MasterOdin merged commit 6e522d6 into cakephp:0.x Jun 3, 2024
@MasterOdin
Copy link
Member

Thanks!

@MichaelRushton
Copy link

MichaelRushton commented Jun 24, 2024

@MasterOdin @ajibarra

This doesn't actually update the documentation, it only changes the displayed version number.

As an example, this code from the documentation throws a fatal error because getQueryBuilder now requires a string $type argument.

$builder = $this->getQueryBuilder();

There are also now getSelectBuilder, getInsertBuilder, getUpdateBuilder, and getDeleteBuilder methods that are undocumented.

@MasterOdin
Copy link
Member

MasterOdin commented Jun 24, 2024

The docs for that hasn't been updated, and can see that in git:

phinx/docs/en/migrations.rst

Lines 1646 to 1676 in 6154850

Using the Query Builder
-----------------------
It is not uncommon to pair database structure changes with data changes. For example, you may want to
migrate the data in a couple columns from the users to a newly created table. For this type of scenarios,
Phinx provides access to a Query builder object, that you may use to execute complex ``SELECT``, ``UPDATE``,
``INSERT`` or ``DELETE`` statements.
The Query builder is provided by the `cakephp/database <https://github.com/cakephp/database>`_ project, and should
be easy to work with as it resembles very closely plain SQL. Accesing the query builder is done by calling the
``getQueryBuilder()`` function:
.. code-block:: php
<?php
use Phinx\Migration\AbstractMigration;
class MyNewMigration extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$builder = $this->getQueryBuilder();
$statement = $builder->select('*')->from('users')->execute();
var_dump($statement->fetchAll());
}
}

The docs are ideally rolling in that we only publish for the latest 0.x release, but things get missed. I'll make an issue to at least keep track of this particular issue, but please make issues for any other things you notice are out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation needs updating

3 participants