Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getQueryBuilder and documentation for 0.15? #2238

Closed
wallacio opened this issue Nov 10, 2023 · 2 comments
Closed

getQueryBuilder and documentation for 0.15? #2238

wallacio opened this issue Nov 10, 2023 · 2 comments

Comments

@wallacio
Copy link
Contributor

Where is the "official" documentation for 0.15?

We've been using 0.13.x for some time now, for which there's great documentation at https://book.cakephp.org/phinx/0/en/index.html.

A recent composer update (amongst other things) has bumped phinx to the 0.15.x release. There are a few breaking changes introduced here, some of which are documented and which I have resolved locally. What I struggled with in particular is working out how getQueryBuilder() works. For starters, it requires a parameter for the query type (e.g. 'select', 'update' etc.)

public function getQueryBuilder(string $type): Query;

Typehinting is also wrong; whilst getQueryBuilder() returns Cake\Database\Query, the IDE doesn't recognise methods belonging to the relevant child class, for example Cake\Database\UpdateQuery which has the methods update() and set():

image

Whilst I appreciate that this typehinting is probably an issue with cakephp\database, it would be great to see some official documentation for 0.15 detailing these changes. There is of course every chance that I'm now using getQueryBuilder incorrectly but I can't see the alternative.

@wallacio
Copy link
Contributor Author

Taking inspiration from cakephp/database, why not replace the getQueryBuilder(string $type) method with type-specific methods, returning the appropriate data type?

e.g. for an INSERT statement,

function getQueryBuilder('insert'): Query

would be replaced with

function getInsertBuilder(): InsertQuery

@dereuromark
Copy link
Member

PR open

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

No branches or pull requests

2 participants