Skip to content

Error processing prado-cli command line arguments #1001

@carlosbfeitozafilho

Description

@carlosbfeitozafilho

I'm trying to overwrite some table class files and for that I'm using the following command line:

.\protected\vendor\bin\prado-cli activerecord/generate-all Application.database false overwrite

But I always get the same response:

*----------------------------------- Error ------------------------------------*
* File *
* D:\Development\PHP\Projects\PradoBlog\protected\database\Users.php *
* already exists, skipping. *
*------------------------------------------------------------------------*

When investigating the source code I noticed two things, first that the way command line arguments are being handled considers their position in the command line (that's why I needed to include "false" before "overwrite"). Second, when the "actionGenerate" function is executed, it checks for the presence of the "overwrite" argument and sets the value to true in $this->_overwriteall, but later on it is checking the field $this->_overwrite, which invariably has false because I am executing the generate-all command (and not generate)

This bug needs to be fixed so that people don't have to delete their table class files before running the command. Additionally, it would be very desirable to change the way command line arguments are obtained so that the simple presence of one of these arguments in any position, and without the need for the inclusion of other arguments, is sufficient.

I also found that the problem with the way to get the command line arguments is preventing the creation of files with prefix/suffix, for example, it is not possible to create files with suffix without prefix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions