cakephp / cakephp/phinx

Documentation Contradiction: insert methods inside a change() method

Open
#2,376 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Under the Inserting Data heading, there's a yellow warning: "You cannot use the insert methods inside a change() method. Please use the up() and down() methods."

But just above on the same page, under The Change Method the last code sample invokes an insert() method from within the change() method.

If this code sample is actually valid, is it because the invocation of insert() is conditional based on isMigratingUp()? If so, that should be explained in the yellow warning under Inserting Data.

Perhaps this:

"Please use the up() and down() methods."

Could be changed to this:

"Please use the up() and down() methods, or when inside a change() method only invoke insert() inside a conditional block when isMigratingUp() or isMigratingDown() is true."

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked “The Change Method” and “Inserting Data” sections in the Phinx documentation, especially the final change() example and the yellow warning. Verify whether the example’s conditional use of insert() is valid, then reconcile the warning and example so the documented rule is consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.