Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
Renamed Data to Entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mengidd committed Oct 13, 2015
1 parent b5d4406 commit 63e0b6b
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 45 deletions.
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Add the provider in `config/app.php`.

| Command | Description |
| ------------- | ------------- |
| php artisan make:data Name [--models={Additional models}] [--seed] [--migration] | Create the a data folder with a model, repository, interface and service provider |
| php artisan make:base-repository | Create the base repository that is needed by the objects created by make:data command, this should only be ran once |
| php artisan make:entitiy Name [--models={Additional models}] [--seed] [--migration] | Create the a entity folder with a model, repository, interface and service provider |
| php artisan make:base-repository | Create the base repository that is needed by the objects created by make:entity command, this should only be ran once |


## Example Usage

php artisan make:data Project --models=Person,Job --seed --migration
php artisan make:entity Project --models=Person,Job --seed --migration

This will create the following files and folders:
```
+-- App
| +-- Data
| +-- Entities
| +-- Project
| +-- Contracts
| +-- ProjectInterface.php
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/BaseRepositoryMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BaseRepositoryMakeCommand extends Command
*
* @var string
*/
protected $description = 'Create the base repository that is needed by the objects created by make:data command';
protected $description = 'Create the base repository that is needed by the objects created by make:entity command';

/**
* @var GeneratorFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Console\AppNamespaceDetectorTrait;
use Kodebyraaet\Generators\GeneratorFactory;

class DataMakeCommand extends Command
class EntityMakeCommand extends Command
{
use AppNamespaceDetectorTrait;

Expand All @@ -13,14 +13,14 @@ class DataMakeCommand extends Command
*
* @var string
*/
protected $signature = 'make:data {name} {--seed} {--migration} {--models=}';
protected $signature = 'make:entity {name} {--seed} {--migration} {--models=}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Create the a data folder with a model, repository, interface and service provider';
protected $description = 'Create the an entity folder with a model, repository, interface and service provider';

/**
* @var GeneratorFactory
Expand Down
6 changes: 3 additions & 3 deletions src/Generators/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BaseRepository extends BaseGenerator
*/
public function directory()
{
return app_path('Data');
return app_path('Entities');
}

/**
Expand All @@ -29,8 +29,8 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}
}
}
6 changes: 3 additions & 3 deletions src/Generators/BaseRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BaseRepositoryInterface extends BaseGenerator
*/
public function directory()
{
return app_path('Data');
return app_path('Entities');
}

/**
Expand All @@ -29,8 +29,8 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}
}
}
10 changes: 5 additions & 5 deletions src/Generators/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Model extends BaseGenerator
*/
public function directory()
{
return app_path('Data/'.$this->name.'/Models');
return app_path('Entities/'.$this->name.'/Models');
}

/**
Expand All @@ -33,12 +33,12 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}

if (!$this->filesystem->isDirectory(app_path('Data/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Data/'.$this->name));
if (!$this->filesystem->isDirectory(app_path('Entities/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Entities/'.$this->name));
}

if (!$this->filesystem->isDirectory($this->directory())) {
Expand Down
10 changes: 5 additions & 5 deletions src/Generators/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Provider extends BaseGenerator
*/
public function directory()
{
return app_path('Data/'.$this->name);
return app_path('Entities/'.$this->name);
}

/**
Expand All @@ -33,12 +33,12 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}

if (!$this->filesystem->isDirectory(app_path('Data/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Data/'.$this->name));
if (!$this->filesystem->isDirectory(app_path('Entities/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Entities/'.$this->name));
}
}
}
10 changes: 5 additions & 5 deletions src/Generators/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Repository extends BaseGenerator
*/
public function directory()
{
return app_path('Data/'.$this->name.'/Repositories');
return app_path('Entities/'.$this->name.'/Repositories');
}

/**
Expand All @@ -33,12 +33,12 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}

if (!$this->filesystem->isDirectory(app_path('Data/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Data/'.$this->name));
if (!$this->filesystem->isDirectory(app_path('Entities/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Entities/'.$this->name));
}

if (!$this->filesystem->isDirectory($this->directory())) {
Expand Down
10 changes: 5 additions & 5 deletions src/Generators/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RepositoryInterface extends BaseGenerator
*/
public function directory()
{
return app_path('Data/'.$this->name.'/Contracts');
return app_path('Entities/'.$this->name.'/Contracts');
}

/**
Expand All @@ -33,12 +33,12 @@ public function filename($name = null)
*/
public function makeFolders()
{
if (!$this->filesystem->isDirectory(app_path('Data'))) {
$this->filesystem->makeDirectory(app_path('Data'));
if (!$this->filesystem->isDirectory(app_path('Entities'))) {
$this->filesystem->makeDirectory(app_path('Entities'));
}

if (!$this->filesystem->isDirectory(app_path('Data/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Data/'.$this->name));
if (!$this->filesystem->isDirectory(app_path('Entities/'.$this->name))) {
$this->filesystem->makeDirectory(app_path('Entities/'.$this->name));
}

if (!$this->filesystem->isDirectory($this->directory())) {
Expand Down
2 changes: 1 addition & 1 deletion src/GeneratorsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function register()
{

$this->app->singleton('command.kodebyraaet.data', function ($app) {
return $app[Commands\DataMakeCommand::class];
return $app[Commands\EntityMakeCommand::class];
});

$this->app->singleton('command.kodebyraaet.repository', function ($app) {
Expand Down
2 changes: 1 addition & 1 deletion src/StubParsers/ProviderStubParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function extraModelsUseStatements()

if (isset($this->data['extraModels'])) {
foreach ($this->data['extraModels'] as $model) {
$string .= PHP_EOL.'use '.$this->appNamespace().'\\Data\\'.$this->model().'\\Models\\'. $model .';';
$string .= PHP_EOL.'use '.$this->appNamespace().'\\Entities\\'.$this->model().'\\Models\\'. $model .';';
}
}
return $string;
Expand Down
2 changes: 1 addition & 1 deletion src/StubParsers/RepositoryStubParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function extraModelsUseStatements()

if (isset($this->data['extraModels'])) {
foreach ($this->data['extraModels'] as $model) {
$string .= PHP_EOL.'use '.$this->appNamespace().'\\Data\\'.$this->model().'\\Models\\'. $model .';';
$string .= PHP_EOL.'use '.$this->appNamespace().'\\Entities\\'.$this->model().'\\Models\\'. $model .';';
}
}
return $string;
Expand Down
6 changes: 3 additions & 3 deletions src/Stubs/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use Illuminate\Support\ServiceProvider;

use {app_namespace}\Data\{model}\Models\{model};{extra_models_use_statements}
use {app_namespace}\Data\{model}\Contracts\{model}Interface;
use {app_namespace}\Data\{model}\Repositories\{model}Repository;
use {app_namespace}\Entities\{model}\Models\{model};{extra_models_use_statements}
use {app_namespace}\Entities\{model}\Contracts\{model}Interface;
use {app_namespace}\Entities\{model}\Repositories\{model}Repository;

class {model}ServiceProvider extends ServiceProvider
{
Expand Down
2 changes: 1 addition & 1 deletion src/Stubs/repository-interface.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace {class_namespace};

use {app_namespace}\Data\RepositoryInterface;
use {app_namespace}\Entities\RepositoryInterface;

interface {model}Interface extends RepositoryInterface
{
Expand Down
6 changes: 3 additions & 3 deletions src/Stubs/repository.stub
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace {class_namespace};

use {app_namespace}\Data\Repository;
use {app_namespace}\Entities\Repository;

use {app_namespace}\Data\{model}\Models\{model};{extra_models_use_statements}
use {app_namespace}\Data\{model}\Contracts\{model}Interface;
use {app_namespace}\Entities\{model}\Models\{model};{extra_models_use_statements}
use {app_namespace}\Entities\{model}\Contracts\{model}Interface;

class {model}Repository extends Repository implements {model}Interface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Stubs/seeder.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use {app_namespace}\Data\{model}\Contracts\{model}Interface;
use {app_namespace}\Entities\{model}\Contracts\{model}Interface;
use Illuminate\Database\Seeder;

class {model}TableSeeder extends Seeder
Expand Down

0 comments on commit 63e0b6b

Please sign in to comment.