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

Enhance pass existing trait #85

Merged
merged 2 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions module/Models/model.stub
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ class {{ ModelName }} extends Model
*/
const MODEL_LINKS_ARRAY = [];

/**
* Define list of other models that will be affected as the current object is part of array
* as the current model is sub-document to it when it gets created
*
* @example ModelClass::class => searchingColumn will be converted to ['searchingColumn['id'], 'columnName', 'sharedInfo']
* @example ModelClass::class => [searchingColumn, creatingColumn]
* @example ModelClass::class => [searchingColumn, creatingColumn, sharedInfoMethod]
*
* @const array
*/
const ON_MODEL_CREATE_PUSH = [];

/**
* Define list of other models that will be affected
* as the current model is sub-document to it when it gets created
Expand Down
8 changes: 5 additions & 3 deletions src/Console/Commands/EngezTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle()
{
$this->init();

$this->validateArguments();
if ($this->validateArguments() === false) return;

$this->create();

Expand Down Expand Up @@ -86,13 +86,15 @@ public function validateArguments()
parent::validateArguments();

if (!in_array($this->option('type'), [static::TYPE_GENERAL, static::TYPE_REQUEST])) {
return $this->missingRequiredOption('This controller type does not exits, Did you mean? ' . implode(PHP_EOL, static::TRAIT_TYPES));
return $this->missingRequiredOption('This trait type does not exits, Did you mean? ' . implode(PHP_EOL, static::TRAIT_TYPES));
}

$baseDir = $this->isRequestTrait() ? 'Traits/Validation' : 'Traits';

if ($this->files->exists($this->modulePath("$baseDir/$this->traitName.php"))) {
return $this->info('You already have this trait');
$this->info('You already have this trait');

return false;
}
}

Expand Down