@@ -11,27 +11,27 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class BaseRepository extends EntityRepository implements RepositoryContract |
13 | 13 | { |
14 | - public function getEntityManager(): EntityManager |
|
14 | + public function getEntityManager (): EntityManager |
|
15 | 15 | { |
16 | 16 | return parent::getEntityManager(); |
17 | 17 | } |
18 | 18 | |
19 | - public function getClassMetadata(): ClassMetadata |
|
19 | + public function getClassMetadata (): ClassMetadata |
|
20 | 20 | { |
21 | 21 | return parent::getClassMetadata(); |
22 | 22 | } |
23 | 23 | |
24 | - public function createQueryWorker(): QueryWorkerContract |
|
24 | + public function createQueryWorker (): QueryWorkerContract |
|
25 | 25 | { |
26 | 26 | return new QueryWorker($this); |
27 | 27 | } |
28 | 28 | |
29 | - public function findAll(): QueryWorkerContract |
|
29 | + public function findAll (): QueryWorkerContract |
|
30 | 30 | { |
31 | 31 | return $this->createQueryWorker(); |
32 | 32 | } |
33 | 33 | |
34 | - public function findOneBy(array $criteria, bool $abort = true): EntityContract |
|
34 | + public function findOneBy (array $criteria, bool $abort = true): EntityContract |
|
35 | 35 | { |
36 | 36 | $findAll = $this->findAll(); |
37 | 37 | |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | abort(404, 'Registro não encontrado'); |
47 | 47 | } |
48 | 48 | |
49 | - public function find($id, bool $abort = true): EntityContract |
|
49 | + public function find ($id, bool $abort = true): EntityContract |
|
50 | 50 | { |
51 | - return $this->findOneBy(['id' => $id], $abort); |
|
51 | + return $this->findOneBy([ 'id' => $id ], $abort); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function findAllRemoved(): QueryWorkerContract |
|
54 | + public function findAllRemoved (): QueryWorkerContract |
|
55 | 55 | { |
56 | 56 | disableSoftDeleteableFilter(); |
57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ->andWhere('deletedAt', 'isnotnull'); |
60 | 60 | } |
61 | 61 | |
62 | - public function findRemoved($id, bool $abort = true): EntityContract |
|
62 | + public function findRemoved ($id, bool $abort = true): EntityContract |
|
63 | 63 | { |
64 | 64 | $entity = $this->findAllRemoved() |
65 | 65 | ->andWhere('id', '=', $id) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | abort(404, 'Registro não encontrado'); |
75 | 75 | } |
76 | 76 | |
77 | - public function createEntity(): EntityContract |
|
77 | + public function createEntity (): EntityContract |
|
78 | 78 | { |
79 | 79 | $entityName = $this->getEntityName(); |
80 | 80 |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | * Default binding a repository interface to a concret class |
5 | 5 | */ |
6 | 6 | if (!function_exists('bind_contract_repository')) { |
7 | - function bind_contract_repository(string $repositoryInterface, string $repository, string $entity) |
|
7 | + function bind_contract_repository (string $repositoryInterface, string $repository, string $entity) |
|
8 | 8 | { |
9 | 9 | app()->bind($repositoryInterface, function ($app) use ($repository, $entity) { |
10 | 10 | return new $repository( |
11 | - $app['em'], |
|
12 | - $app['em']->getClassMetaData($entity) |
|
11 | + $app[ 'em' ], |
|
12 | + $app[ 'em' ]->getClassMetaData($entity) |
|
13 | 13 | ); |
14 | 14 | }); |
15 | 15 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @param string $className |
21 | 21 | */ |
22 | - function bdEntityName(string $className) |
|
22 | + function bdEntityName (string $className) |
|
23 | 23 | { |
24 | 24 | return config('bludata.generator.rootNamespace').'Entities\\'.$className; |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @param string $className |
31 | 31 | */ |
32 | - function bdEntity(string $className) |
|
32 | + function bdEntity (string $className) |
|
33 | 33 | { |
34 | 34 | return app(bdEntityName($className)); |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @param string $className |
41 | 41 | */ |
42 | - function bdContractName(string $className) |
|
42 | + function bdContractName (string $className) |
|
43 | 43 | { |
44 | 44 | return config('bludata.generator.rootNamespace').'Contracts\Repositories\\'.$className.'RepositoryContract'; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @param string $className |
51 | 51 | */ |
52 | - function bdRepositoryName(string $className) |
|
52 | + function bdRepositoryName (string $className) |
|
53 | 53 | { |
54 | 54 | return config('bludata.generator.rootNamespace').'Repositories\\'.$className.'Repository'; |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @param string $className |
61 | 61 | */ |
62 | - function bdRepository(string $className) |
|
62 | + function bdRepository (string $className) |
|
63 | 63 | { |
64 | 64 | return app(bdContractName($className)); |
65 | 65 | } |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | |
5 | 5 | trait ToArrayTrait |
6 | 6 | { |
7 | - public function toArray(array $options = []): array |
|
7 | + public function toArray (array $options = [ ]): array |
|
8 | 8 | { |
9 | 9 | $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
10 | 10 | $annotationReader = new AnnotationReader(); |
11 | 11 | $propertyAnnotations = $annotationReader->getPropertyAnnotations($reflectionProperty); |
12 | 12 | |
13 | - $array = []; |
|
13 | + $array = [ ]; |
|
14 | 14 | |
15 | 15 | $classMetadata = $this->getRepository() |
16 | 16 | ->getClassMetadata(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dateFormat = 'Y-m-d'; |
26 | 26 | |
27 | 27 | if ($metaDataKey) { |
28 | - switch ($metaDataKey['type']) { |
|
28 | + switch ($metaDataKey[ 'type' ]) { |
|
29 | 29 | case 'datetime': |
30 | 30 | $dateFormat = 'Y-m-d H:i:s'; |
31 | 31 | break; |
@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - $array[$key] = $this->$key->format($dateFormat); |
|
40 | + $array[ $key ] = $this->$key->format($dateFormat); |
|
41 | 41 | } |
42 | 42 | } elseif ($this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) { |
43 | - $ids = []; |
|
43 | + $ids = [ ]; |
|
44 | 44 | |
45 | 45 | foreach ($this->$key->getValues() as $item) { |
46 | - $ids[] = $item->getId(); |
|
46 | + $ids[ ] = $item->getId(); |
|
47 | 47 | } |
48 | 48 | |
49 | - $array[$key] = $ids; |
|
49 | + $array[ $key ] = $ids; |
|
50 | 50 | } else { |
51 | 51 | if (method_exists($this->$key, 'getId')) { |
52 | - $array[$key] = $this->$key->getId(); |
|
52 | + $array[ $key ] = $this->$key->getId(); |
|
53 | 53 | } else { |
54 | - $array[$key] = $this->$key; |
|
54 | + $array[ $key ] = $this->$key; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } else { |
58 | - if ($metaDataKey['type'] == 'decimal') { |
|
59 | - $array[$key] = (float) $this->$key; |
|
58 | + if ($metaDataKey[ 'type' ] == 'decimal') { |
|
59 | + $array[ $key ] = (float) $this->$key; |
|
60 | 60 | } else { |
61 | - $array[$key] = $this->$key; |
|
61 | + $array[ $key ] = $this->$key; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |