Skip to content

Commit 9084ee3

Browse files
committed
chore: rename entities
Use singular name to entities because an entity represent the singular and not the plural. Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent ec00b60 commit 9084ee3

File tree

31 files changed

+69
-62
lines changed

31 files changed

+69
-62
lines changed

docs/class.bkp.bkp.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ classDiagram
2222
}
2323
2424
namespace Source {
25-
class Customers
26-
class Invoices
25+
class Customer
26+
class Invoice
2727
%% class Nfse
28-
%% class Projects
28+
%% class Project
2929
%% class Timesheet
30-
%% class Transactions
31-
%% class Users
30+
%% class Transaction
31+
%% class User
3232
}
3333
3434
namespace Provider {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
* $method ?int getParentId()
4040
* $method array getMetadata()
4141
*/
42+
#[ORM\Table(name: 'categories')]
4243
#[ORM\Entity]
43-
class Categories
44+
class Category
4445
{
4546
use MagicGetterSetterTrait;
4647
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'customers')]
3435
#[ORM\Entity]
35-
class Customers
36+
class Customer
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'invoices')]
3435
#[ORM\Entity]
35-
class Invoices
36+
class Invoice
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'projects')]
3435
#[ORM\Entity]
35-
class Projects
36+
class Project
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'taxes')]
3435
#[ORM\Entity]
35-
class Taxes
36+
class Tax
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'transactions')]
3435
#[ORM\Entity]
35-
class Transactions
36+
class Transaction
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
use Doctrine\DBAL\Types\Types;
3232
use Doctrine\ORM\Mapping as ORM;
3333

34+
#[ORM\Table(name: 'users')]
3435
#[ORM\Entity]
35-
class Users
36+
class User
3637
{
3738
use MagicGetterSetterTrait;
3839
use EntityArrayMapperTrait;

src/Service/Akaunting/Document/Taxes/Tax.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace App\Service\Akaunting\Document\Taxes;
2828

29-
use App\Entity\Producao\Taxes;
29+
use App\Entity\Producao\Tax as EntityTax;
3030
use Doctrine\DBAL\ParameterType;
3131
use Exception;
3232
use App\Service\Akaunting\Document\ADocument;
@@ -83,7 +83,7 @@ private function pegaValorAPagar(): float
8383

8484
private function getPercentualDoImposto(): float
8585
{
86-
$tax = $this->entityManager->getRepository(Taxes::class)->find($this->taxData->taxId);
86+
$tax = $this->entityManager->getRepository(EntityTax::class)->find($this->taxData->taxId);
8787
return $tax->getRate();
8888
}
8989

src/Service/Akaunting/Source/Categories.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace App\Service\Akaunting\Source;
2828

29-
use App\Entity\Producao\Categories as EntityCategories;
29+
use App\Entity\Producao\Category;
3030
use App\Helper\MagicGetterSetterTrait;
3131
use App\Provider\Akaunting\Dataset;
3232
use Doctrine\ORM\EntityManagerInterface;
@@ -37,7 +37,7 @@ class Categories
3737
{
3838
use MagicGetterSetterTrait;
3939
private int $companyId;
40-
/** @var EntityCategories[] */
40+
/** @var Category[] */
4141
private array $list = [];
4242

4343
public function __construct(
@@ -49,7 +49,7 @@ public function __construct(
4949
}
5050

5151
/**
52-
* @return EntityCategories[]
52+
* @return Category[]
5353
*/
5454
public function getList(): array
5555
{
@@ -71,12 +71,12 @@ public function getList(): array
7171
return $this->list ?? [];
7272
}
7373

74-
public function fromArray(array $array): EntityCategories
74+
public function fromArray(array $array): Category
7575
{
76-
$entity = $this->entityManager->find(EntityCategories::class, $array['id']);
76+
$entity = $this->entityManager->find(Category::class, $array['id']);
7777
$array = $this->convertFields($array);
78-
if (!$entity instanceof EntityCategories) {
79-
$entity = new EntityCategories();
78+
if (!$entity instanceof Category) {
79+
$entity = new Category();
8080
}
8181
$entity->fromArray($array);
8282
return $entity;
@@ -91,7 +91,7 @@ public function saveList(): self
9191
return $this;
9292
}
9393

94-
public function saveRow(EntityCategories $taxes): self
94+
public function saveRow(Category $taxes): self
9595
{
9696
$em = $this->entityManager;
9797
$em->persist($taxes);
@@ -110,7 +110,7 @@ public function getCategories(): array
110110
if (!empty($this->list)) {
111111
return $this->list;
112112
}
113-
$this->list = $this->entityManager->getRepository(EntityCategories::class)->findAll();
113+
$this->list = $this->entityManager->getRepository(Category::class)->findAll();
114114
if (empty($this->list)) {
115115
throw new Exception('Sem categorias');
116116
}

0 commit comments

Comments
 (0)