Skip to content

[RFC][make:entity] Add an option to generate fluent or not fluent setters #297

Open
@maks-rafalko

Description

@maks-rafalko

Hi everyone!

The only one mention about fluent setters I found is here: #104, but nothing has been implemented as far as I see from the source code.

There is a flag that checks whether to generate fluent setters or not, here

private function makeMethodFluent(Builder\Method $methodBuilder)
{
if (!$this->fluentMutators) {
return;
}

but it's impossible to override the default value (which is true - setters are fluent), because manipulator class is instantiated always with true:

$manipulator = new ClassSourceManipulator($this->fileManager->getFileContents($path), $overwrite);

Note the last parameter

public function __construct(string $sourceCode, bool $overwrite = false, bool $useAnnotations = true, bool $fluentMutators = true)

Proposal

What do you think about adding an option that will allow overriding this flag? For example:

bin/console make:entity --fluent-setters=false

or something like that.

If this would be useful from your point of view, I would be able to send a PR.

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