Skip to content

Commit 7c8531f

Browse files
authored
Support 7 (#450)
* Add sf 7 to composer.json * Added missing dependencies * Added dependency on Symfony validator * Fix frontend (bug probably also exists in the 6 branch) * Fix also the error conditions in the UI * Restrict composer.json to SF 7. The 6 branch is for SF 6, let's keep them separate * Restrict composer.json to SF 7. The 6 branch is for SF 6, let's keep them separate * Update minimum php version * Update github action to use php 8.2 * Remove propel support and fix unit tests (differences in loading files with odm definitions) * Update the version of github actions to v4 * Remove * from composer.json
1 parent 6bd4e3d commit 7c8531f

39 files changed

+115
-1759
lines changed

.github/workflows/php.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Run tests
22

3+
34
on:
45
push:
56
branches: [ "master" ]
@@ -9,6 +10,7 @@ on:
910
permissions:
1011
contents: read
1112

13+
1214
jobs:
1315
build:
1416

@@ -32,14 +34,20 @@ jobs:
3234
MONGO_INITDB_ROOT_PASSWORD: secret
3335

3436
steps:
35-
- uses: actions/checkout@v3
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: '8.2'
41+
extensions: mbstring, intl
42+
43+
- uses: actions/checkout@v4
3644

3745
- name: Validate composer.json and composer.lock
3846
run: composer validate --strict
3947

4048
- name: Cache Composer packages
4149
id: composer-cache
42-
uses: actions/cache@v3
50+
uses: actions/cache@v4
4351
with:
4452
path: vendor
4553
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
vendor
22
composer.lock
3-
Propel/map
4-
Propel/om
53

64
Tests/app/tmp/

DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public function getConfigTreeBuilder(): TreeBuilder
2727
$storages = [
2828
StorageInterface::STORAGE_ORM,
2929
StorageInterface::STORAGE_MONGODB,
30-
StorageInterface::STORAGE_PROPEL,
3130
];
3231
$registrationTypes = ['all', 'files', 'database'];
3332
$inputTypes = ['text', 'textarea'];

DependencyInjection/LexikTranslationExtension.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ protected function buildTranslationStorageDefinition(ContainerBuilder $container
169169
$args = [new Reference('doctrine_mongodb'), $objectManager ?? 'default'];
170170

171171
$this->createDoctrineMappingDriver($container, 'lexik_translation.mongodb.metadata.xml', '%doctrine_mongodb.odm.metadata.xml.class%');
172-
} elseif (StorageInterface::STORAGE_PROPEL == $storage) {
173-
// In the Propel case the object_manager setting is used for the connection name
174-
$args = [$objectManager];
175172
} else {
176173
throw new \RuntimeException(sprintf('Unsupported storage "%s".', $storage));
177174
}

Form/Handler/TransUnitFormHandler.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Lexik\Bundle\TranslationBundle\Manager\FileInterface;
88
use Lexik\Bundle\TranslationBundle\Manager\FileManagerInterface;
99
use Lexik\Bundle\TranslationBundle\Storage\StorageInterface;
10-
use Lexik\Bundle\TranslationBundle\Propel\TransUnit as PropelTransUnit;
1110
use Symfony\Component\Form\FormInterface;
1211
use Symfony\Component\HttpFoundation\Request;
1312

@@ -76,11 +75,6 @@ public function process(FormInterface $form, Request $request)
7675
}
7776
}
7877

79-
if ($transUnit instanceof PropelTransUnit) {
80-
// The setTranslations() method only accepts PropelCollections
81-
$translations = new \PropelObjectCollection($translations);
82-
}
83-
8478
$transUnit->setTranslations($translations);
8579

8680
$this->storage->persist($transUnit);

Model/File.php

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

33
namespace Lexik\Bundle\TranslationBundle\Model;
44

5+
56
use Doctrine\Common\Collections\ArrayCollection;
7+
use Doctrine\Common\Collections\Collection;
68
use Symfony\Component\Validator\Constraints as Assert;
79

810
/**
@@ -12,155 +14,90 @@
1214
*/
1315
abstract class File
1416
{
15-
/**
16-
* @var int
17-
*/
1817
protected $id;
1918

2019
/**
21-
* @var string
22-
*
2320
* @Assert\NotBlank()
2421
*/
25-
protected $domain;
22+
protected string $domain;
2623

2724
/**
28-
* @var string
29-
*
3025
* @Assert\NotBlank()
3126
*/
32-
protected $locale;
27+
protected string $locale;
3328

3429
/**
35-
* @var string
36-
*
3730
* @Assert\NotBlank()
3831
*/
39-
protected $extention;
32+
protected string $extention;
4033

4134
/**
42-
* @var string
43-
*
4435
* @Assert\NotBlank()
4536
*/
46-
protected $path;
37+
protected string $path;
4738

4839
/**
49-
* @var string
50-
*
5140
* @Assert\NotBlank()
5241
*/
53-
protected $hash;
42+
protected string $hash;
5443

55-
/**
56-
* @var Doctrine\Common\Collections\Collection
57-
*/
58-
protected $translations;
44+
protected Collection $translations;
45+
46+
protected $createdAt;
47+
48+
protected $updatedAt;
5949

60-
/**
61-
* Construct.
62-
*/
6350
public function __construct()
6451
{
6552
$this->translations = new ArrayCollection();
6653
}
6754

68-
/**
69-
* Get id
70-
*
71-
* @return int
72-
*/
7355
public function getId()
7456
{
7557
return $this->id;
7658
}
7759

78-
/**
79-
* Set domain
80-
*
81-
* @param string $domain
82-
*/
83-
public function setDomain($domain)
60+
public function setDomain(string $domain): void
8461
{
8562
$this->domain = $domain;
8663
}
8764

88-
/**
89-
* Get domain
90-
*
91-
* @return string
92-
*/
93-
public function getDomain()
65+
public function getDomain(): string
9466
{
9567
return $this->domain;
9668
}
9769

98-
/**
99-
* Set locale
100-
*
101-
* @param string $locale
102-
*/
103-
public function setLocale($locale)
70+
public function setLocale(string $locale): void
10471
{
10572
$this->locale = $locale;
10673
}
10774

108-
/**
109-
* Get locale
110-
*
111-
* @return string
112-
*/
113-
public function getLocale()
75+
public function getLocale(): string
11476
{
11577
return $this->locale;
11678
}
11779

118-
/**
119-
* Set extention
120-
*
121-
* @param string $extention
122-
*/
123-
public function setExtention($extention)
80+
public function setExtention(string $extention): void
12481
{
12582
$this->extention = $extention;
12683
}
12784

128-
/**
129-
* Get extention
130-
*
131-
* @return string
132-
*/
133-
public function getExtention()
85+
public function getExtention(): string
13486
{
13587
return $this->extention;
13688
}
13789

138-
/**
139-
* Set path
140-
*
141-
* @param string $path
142-
*/
143-
public function setPath($path)
90+
public function setPath(string $path): void
14491
{
14592
$this->path = $path;
14693
}
14794

148-
/**
149-
* Get path
150-
*
151-
* @return string
152-
*/
153-
public function getPath()
95+
public function getPath(): string
15496
{
15597
return $this->path;
15698
}
15799

158-
/**
159-
* Set file name
160-
*
161-
* @param string $name
162-
*/
163-
public function setName($name)
100+
public function setName(string $name): void
164101
{
165102
[$domain, $locale, $extention] = explode('.', $name);
166103

@@ -169,52 +106,29 @@ public function setName($name)
169106
$this->extention = $extention;
170107
}
171108

172-
/**
173-
* Get file name
174-
*
175-
* @return string
176-
*/
177-
public function getName()
109+
public function getName(): string
178110
{
179111
return sprintf('%s.%s.%s', $this->domain, $this->locale, $this->extention);
180112
}
181113

182-
/**
183-
* Set hash
184-
*
185-
* @return string
186-
*/
187-
public function setHash($hash)
114+
public function setHash(string $hash): void
188115
{
189116
$this->hash = $hash;
190117
}
191118

192-
/**
193-
* Get hash
194-
*
195-
* @return string
196-
*/
197-
public function getHash()
119+
public function getHash(): string
198120
{
199121
return $this->hash;
200122
}
201123

202-
/**
203-
* Add translation
204-
*/
205-
public function addTranslation(\Lexik\Bundle\TranslationBundle\Model\Translation $translation)
124+
public function addTranslation(Translation $translation): void
206125
{
207126
$translation->setFile($this);
208127

209128
$this->translations[] = $translation;
210129
}
211130

212-
/**
213-
* Get translations
214-
*
215-
* @return \Doctrine\Common\Collections\Collection
216-
*/
217-
public function getTranslations()
131+
public function getTranslations(): Collection
218132
{
219133
return $this->translations;
220134
}

Propel/File.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

Propel/FileQuery.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)