Skip to content

Commit da32551

Browse files
Merge pull request #228 from edmondscommerce/DoctrineUpdateFixes
Doctrine update fixes
2 parents ed77cc7 + 9594bb9 commit da32551

File tree

17 files changed

+36
-57
lines changed

17 files changed

+36
-57
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
## By [Edmonds Commerce](https://www.edmondscommerce.co.uk)
33

44
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/00a50e56835f45b0ba32eed9c0285ede)](https://www.codacy.com/app/edmondscommerce/doctrine-static-meta?utm_source=github.com&utm_medium=referral&utm_content=edmondscommerce/doctrine-static-meta&utm_campaign=Badge_Grade)
5-
[![Build Status](https://travis-ci.org/edmondscommerce/doctrine-static-meta.svg?branch=master)](https://travis-ci.org/edmondscommerce/doctrine-static-meta)
5+
66
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/edmondscommerce/doctrine-static-meta/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/edmondscommerce/doctrine-static-meta/?branch=master)
7-
[![Code Coverage](https://scrutinizer-ci.com/g/edmondscommerce/doctrine-static-meta/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/edmondscommerce/doctrine-static-meta/?branch=master)
7+
88
[![Code Intelligence Status](https://scrutinizer-ci.com/g/edmondscommerce/doctrine-static-meta/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)
9+
910
[![Maintainability](https://api.codeclimate.com/v1/badges/fd4655978dc2137dd375/maintainability)](https://codeclimate.com/github/edmondscommerce/doctrine-static-meta/maintainability)
1011

1112
An implementation of Doctrine using the [PHP Static Meta Data driver](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/php-mapping.html#static-function) and no annotations.
@@ -42,6 +43,6 @@ password=YOURPASSWORDHERE
4243

4344
## Further Reading
4445

45-
Documention is still very much a work in progress...
46+
Documentation is still very much a work in progress...
4647

4748
Have a look in the [docs](docs) Folder

docs/Background.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,3 @@ There is a generator and command to support easily creating these. The field tra
5454

5555
Finally, we are able to handle the relationship between Entities by using Traits.
5656

57-
To see how this works, it is suggest you have a look through some of the [example projects](https://github.com/edmondscommerce/doctrine-static-meta-example)

docs/Getting-Started.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ This document describes how to get started with a DSM based Entities project
44

55
The document assumes starting from a completely clean slate.
66

7-
## Example Project
8-
9-
To help to explain how to work with this library, there is a separate repo with some example projects:
10-
11-
https://github.com/edmondscommerce/doctrine-static-meta-example
12-
137
## Set up Composer Dependencies
148

159
```
@@ -287,8 +281,6 @@ Ideally each Field will have some tests that ensure that the validation etc is a
287281

288282
It is highly recommended that you have a build script to build up your entities, relations, fields, embeddables
289283

290-
For inspiration on how to do this, suggest looking at the aforementioned [example projects repo](https://github.com/edmondscommerce/doctrine-static-meta-example)
291-
292284
You have the choice of writing a BASH script which runs the commands, or writing a PHP script which interacts with the [Generator](./../src/CodeGeneration/Generator) objects directly.
293285

294286
**The recommended approach is to write your build script in PHP**

qaConfig/qaConfig.inc.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
#Disable PHPUnit Coverage and allow it to run without xdebug - much faster
3-
export phpUnitCoverage=0
3+
if [[ "${CI:-false}" != "true " ]]; then
4+
export phpUnitCoverage=0
5+
fi
46

57
# Infection Configs
68
## Due to requiring to track random values, we can only run tests in a single thread

src/CodeGeneration/Command/GenerateFieldCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\Console\Input\InputInterface;
1212
use Symfony\Component\Console\Input\InputOption;
1313
use Symfony\Component\Console\Output\OutputInterface;
14+
1415
use function ltrim;
1516

1617
class GenerateFieldCommand extends AbstractCommand
@@ -129,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
129130

130131
$this->fieldGenerator->generateField(
131132
ltrim($input->getOption(self::OPT_FQN), '\\'),
132-
ltrim($input->getOption(self::OPT_TYPE),'\\'),
133+
ltrim($input->getOption(self::OPT_TYPE), '\\'),
133134
null,
134135
$input->getOption(self::OPT_DEFAULT_VALUE) ?? null,
135136
$input->getOption(self::OPT_IS_UNIQUE)

src/CodeGeneration/Filesystem/File/FindReplace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use Doctrine\Common\Inflector\Inflector;
88
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File;
9-
109
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
10+
1111
use function lcfirst;
1212
use function preg_replace;
1313
use function str_replace;

src/CodeGeneration/Generator/Field/IdTrait.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,17 @@
22

33
declare(strict_types=1);
44

5-
/**
6-
* @category EdmondsCommerce
7-
* @package EdmondsCommerce_
8-
* @author Ross Mitchell <ross@edmondscommerce.co.uk>
9-
*/
10-
115
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Field;
126

137
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\FindAndReplaceHelper;
148
use LogicException;
159

1610
class IdTrait
1711
{
18-
public const ID_FIELD_TRAIT = 1;
19-
public const INTEGER_ID_FIELD_TRAIT = 2;
20-
public const NON_BINARY_UUID_TRAIT = 4;
21-
public const UUID_FIELD_TRAIT = 8;
12+
public const ID_FIELD_TRAIT = 1;
13+
public const INTEGER_ID_FIELD_TRAIT = 2;
14+
public const NON_BINARY_UUID_TRAIT = 4;
15+
public const UUID_FIELD_TRAIT = 8;
2216
public const NON_ORDERED_UUID_FIELD_TRAIT = 16;
2317
/**
2418
* @var FindAndReplaceHelper

src/CodeGeneration/Generator/Field/StandardLibraryTestGenerator.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
declare(strict_types=1);
44

5-
/**
6-
* When working on the standard library fields, this will generate a skeleton test for any fields you generate
7-
*/
8-
95
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Field;
106

117
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\CodeHelper;
@@ -23,6 +19,9 @@
2319
use function realpath;
2420
use function str_replace;
2521

22+
/**
23+
* When working on the standard library fields, this will generate a skeleton test for any fields you generate
24+
*/
2625
class StandardLibraryTestGenerator
2726
{
2827
private const FIELDS_PATH = __DIR__ . '/../../../Entity/Fields/Traits';

src/Entity/Repositories/AbstractEntityRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ protected function initRepository(): void
104104
protected function getEntityFqn(): string
105105
{
106106
return '\\' . str_replace(
107-
[
107+
[
108108
'Entity\\Repositories',
109109
],
110-
[
110+
[
111111
'Entities',
112112
],
113-
$this->namespaceHelper->cropSuffix(static::class, 'Repository')
114-
);
113+
$this->namespaceHelper->cropSuffix(static::class, 'Repository')
114+
);
115115
}
116116

117117
public function getRandomResultFromQueryBuilder(QueryBuilder $queryBuilder, string $entityAlias): ?EntityInterface

src/Entity/Savers/AbstractBulkProcess.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ public function addEntitiesToSave(array $entities)
141141
try {
142142
$this->bulkSaveIfChunkBigEnough();
143143
} catch (DBALException $DBALException) {
144-
throw new \RuntimeException('Failed saving chunk ' . $num . ' of ' . count($chunks),
145-
$DBALException->getCode(),
146-
$DBALException);
144+
throw new \RuntimeException(
145+
'Failed saving chunk ' . $num . ' of ' . count($chunks),
146+
$DBALException->getCode(),
147+
$DBALException
148+
);
147149
}
148150
}
149151
$this->entitiesToSave = array_merge($this->entitiesToSave, $entitiesToSaveBackup);

0 commit comments

Comments
 (0)