Skip to content
Permalink
Browse files
Merge remote-tracking branch 'sulu/release/2.0'
  • Loading branch information
danrot committed Feb 19, 2020
2 parents 6a7a349 + 6202c01 commit dd99ea0f0ee8b5afc7995f79ac6fd3c3bced5027
Showing 14 changed files with 185 additions and 212 deletions.
@@ -35,12 +35,14 @@ jobs:
- name: Get php-cs-fixer path
id: php-cs-fixer-path
run: echo "::set-output name=path::${{ steps.php-cs-fixer-dir.outputs.dir }}/php-cs-fixer.phar"
- name: Cache dependencies
- name: Cache php-cs-fixer
id: php-cs-fixer-cache
uses: actions/cache@v1
with:
path: ${{ steps.php-cs-fixer-dir.outputs.dir }}
key: php-cs-fixer
- name: Download php-cs-fixer
if: steps.php-cs-fixer-cache.outputs.cache-hit != 'true'
run: curl "https://cs.symfony.com/download/php-cs-fixer-v2.phar" --output ${{ steps.php-cs-fixer-path.outputs.path }} && chmod +x ${{ steps.php-cs-fixer-path.outputs.path }}
- name: Run php-cs-fixer
run: ./${{ steps.php-cs-fixer-path.outputs.path }} fix --dry-run --diff
@@ -2333,146 +2333,6 @@ The `/admin/api/categories` endpoint delivered a flat list of categories with a
a `categories` key, under which all sub categories are located. This way not every client using this API has to build
a tree using the `parentId` on their own.

## 2.0.0-alpha2

### parent query parameter

The `parent` query parameter, which is used in quite some controllers like for pages and categories, was renamed to
`parentId`, because it only references the id, and not the entire reference. This is also the new convention within
our new Admin, so if your API should work with it, you have to name the query paramter `parentId`.

### Highlight section

In previous versions of Sulu a section named `highlight` had a special design in the administratin interface. Its
background was darker than the rest of the form. This was removed with the new design, and therefore a `highlight`
section does not do anything special anymore, and therefore can be safely removed from your template XML files.

## 2.0.0-alpha1

### Admin Navigation

The admin navigation should not be built into the constructor anymore. Instead of `setNavigation`
create `getNavigation` function in the `Admin` class which should return a `Navigation` object.
This makes it easier to override only this part of the Admin.

### sulu.rlp tag deprecated

The `sulu.rlp` tag, which can be added in the template XMLs, is not used anymore by the new UI. Instead the result of
the URL generation will be simply put into the `resource_locator` field type.

### Test Setup changed

If you use the SuluTestBundle to test your custom sulu bundles you maybe need to change in your test config.yml
the path to the gedmo extension:

```yml
doctrine:
orm:
mappings:
gedmo_tree:
type: xml
prefix: Gedmo\Tree\Entity
dir: "%kernel.root_dir%/../../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
alias: GedmoTree
is_bundle: false
```

### Field Descriptor interface changed

The field descriptor parameter `$default` and `$disabled` where combined into a new parameter `$visibility`:

Use the following table for upgrading:

| Disabled | Default | Visiblity
|----------|----------|--------------
| false | true | FieldDescriptorInterface::VISIBILITY_ALWAYS (always)
| false | false | FieldDescriptorInterface::VISIBILITY_YES (yes)
| true | false | FieldDescriptorInterface::VISIBILITY_NO (no)
| true | true | FieldDescriptorInterface::VISIBILITY_NEVER (never)

We have also introduced a new parameter `$searchability` on the fourth position.

The following table shows the values:

| Value | Description | Searchability
|--------|-----------------------------|--------------
| NEVER | not searchable at all | FieldDescriptorInterface::SEARCHABILITY_NEVER (never)
| NO | it's not used per default | FieldDescriptorInterface::SEARCHABILITY_NO (no)
| YES | it's used per default | FieldDescriptorInterface::SEARCHABILITY_YES (yes)

This new property brings use the possibility to use our REST Api's without the parameter `searchFields`.
Default behavior then is to use all fields with `searchability` set to `YES`.

**Before**

```php
new FieldDescriptor(
'name',
'translation',
false, // Disabled
true, // Default
// ...
);
```

**After**

```php
new FieldDescriptor(
'name',
'translation',
FieldDescriptorInterface::VISIBILITY_YES, // Visibility
FieldDescriptorInterface::SEARCHABILITY_NEVER, // Searchability
// ...
);
```

The same is also for the `DoctrineFieldDescriptor`, `DoctrineJoinDescriptor`, ...:

**Before**

```php
new DoctrineFieldDescriptor(
'fieldName',
'name',
'entityName',
'translation',
[],
false, // Disabled
true, // Default
// ...
);
```

**After**

```php
new DoctrineFieldDescriptor(
'fieldName',
'name',
'entityName',
'translation',
[],
FieldDescriptorInterface::VISIBILITY_YES, // Visibility
FieldDescriptorInterface::SEARCHABILITY_NEVER, // Searchability
// ...
);
```

In the xml definition of the list `display` was replaced with `visibility` and `searchability` was added:

**Before**

```xml
<property display="yes" />
```

**After**

```xml
<property visibility="yes" searchability="yes" />
```

### Dependencies

Removed required dependency `pulse00/ffmpeg-bundle`. If you want to use preview images for videos, run following
@@ -16,7 +16,7 @@ environment:
MYSQL_VERSION: 8.0.17
NODEJS_VERSION: "12"
matrix:
- PHP_VERSION: 7.2.4
- PHP_VERSION: 7.2.5

hosts:
localhost: 127.0.0.1
@@ -92,6 +92,7 @@
"symfony/routing": "^4.3",
"symfony/security": "^4.3",
"symfony/security-bundle": "^4.3",
"symfony/string": "^5.0",
"symfony/swiftmailer-bundle": "^3.1.4",
"symfony/translation": "^4.3",
"symfony/twig-bundle": "^4.3",
@@ -1211,4 +1211,10 @@
<column name="from"><![CDATA[&]]></column>
<column name="to">y</column>
</item>

<item>
<column name="locale">BG</column>
<column name="from"><![CDATA[&]]></column>
<column name="to">и</column>
</item>
</replacers>
@@ -32,12 +32,18 @@
</parameters>

<services>
<service id="sulu.content.slugger" class="Symfony\Component\String\Slugger\AsciiSlugger" />

<service id="sulu.content.path_cleaner.replacer_loader.file_locator" class="%sulu.content.path_cleaner.replacer_loader.file_locator.class%" synthetic="false">
</service>
<service id="sulu.content.path_cleaner.replacer_loader" class="%sulu.content.path_cleaner.replacer_loader.class%" synthetic="false">
<argument type="service" id="sulu.content.path_cleaner.replacer_loader.file_locator"/>
</service>
<service id="sulu.content.path_cleaner" class="%sulu.content.path_cleaner.class%" public="true"/>
<service id="sulu.content.path_cleaner" class="%sulu.content.path_cleaner.class%" public="true">
<argument type="collection" key="$replacers">
</argument>
<argument type="service" key="$slugger" id="sulu.content.slugger"/>
</service>
<service id="sulu.content.template_resolver" public="false" class="%sulu.content.template_resolver.class%"/>

<!-- content mapper -->
@@ -69,6 +69,10 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('slugifier')
->defaultValue('Sulu\Bundle\DocumentManagerBundle\Slugifier\Urlizer::urlize')
->setDeprecated(
'The "sulu_document_manager.slugifier" configuration is not used anymore since 2.1 '
. 'and will be removed in 3.0.'
)
->end()
->arrayNode('mapping')
->useAttributeAsKey('alias')
@@ -43,8 +43,8 @@
<argument type="service" id="sulu_document_manager.metadata_factory.base" />
</service>

<service id="sulu_document_manager.slugifier" class="Symfony\Cmf\Api\Slugifier\CallbackSlugifier" public="false">
<argument>%sulu_document_manager.slugifier%</argument>
<service id="sulu_document_manager.slugifier" class="Sulu\Component\DocumentManager\Slugifier\PathCleanupSlugifier" public="false">
<argument type="service" id="sulu.content.path_cleaner"/>
</service>

<service id="sulu_document_manager.node_name_slugifier"
@@ -36,6 +36,8 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author <hsivonen@iki.fi>
*
* @deprecated since 2.1. To be removed in 3.0
*/
class Urlizer
{
@@ -1464,10 +1464,10 @@ public function testCopyWithShadow()
$uuid = json_decode($this->client->getResponse()->getContent(), true)['id'];

$germanDocument = $this->documentManager->find($uuid, 'de');
$this->assertStringStartsWith('/test_de/test_de', $germanDocument->getResourceSegment());
$this->assertStringStartsWith('/test-de/test-de', $germanDocument->getResourceSegment());

$englishDocument = $this->documentManager->find($uuid, 'en');
$this->assertStringStartsWith('/test_en/test_en', $englishDocument->getResourceSegment());
$this->assertStringStartsWith('/test-en/test-en', $englishDocument->getResourceSegment());
}

public function testCopyNonExistingSource()
@@ -125,24 +125,24 @@ public function testImport12Xliff()
$this->assertEquals($import->successes, 2);

// structure
$this->assertEquals($loadedDocuments[0]->getTitle(), 'test 0 imported');
$this->assertEquals($loadedDocuments[1]->getTitle(), 'test 1 imported');
$this->assertEquals('test 0 imported', $loadedDocuments[0]->getTitle());
$this->assertEquals('test 1 imported', $loadedDocuments[1]->getTitle());

// path
$this->assertEquals($loadedDocuments[0]->getPath(), '/cmf/sulu_io/contents/test-0-imported');
$this->assertEquals($loadedDocuments[1]->getPath(), '/cmf/sulu_io/contents/test-1-imported');
$this->assertEquals('/cmf/sulu_io/contents/test-0-imported', $loadedDocuments[0]->getPath());
$this->assertEquals('/cmf/sulu_io/contents/test-1-imported', $loadedDocuments[1]->getPath());

// resource segment
$this->assertEquals($loadedDocuments[0]->getResourceSegment(), '/parent');
$this->assertEquals($loadedDocuments[1]->getResourceSegment(), '/child');
$this->assertEquals('/parent', $loadedDocuments[0]->getResourceSegment());
$this->assertEquals('/child', $loadedDocuments[1]->getResourceSegment());

// seo
$this->assertEquals($loadedDocuments[0]->getExtensionsData()->toArray()['seo']['title'], '');
$this->assertEquals($loadedDocuments[1]->getExtensionsData()->toArray()['seo']['title'], 'SEO Title');
$this->assertEquals('', $loadedDocuments[0]->getExtensionsData()->toArray()['seo']['title']);
$this->assertEquals('SEO Title', $loadedDocuments[1]->getExtensionsData()->toArray()['seo']['title']);

// excerpt
$this->assertEquals($loadedDocuments[0]->getExtensionsData()->toArray()['excerpt']['title'], 'Excerpt title');
$this->assertEquals($loadedDocuments[1]->getExtensionsData()->toArray()['excerpt']['title'], '');
$this->assertEquals('Excerpt title', $loadedDocuments[0]->getExtensionsData()->toArray()['excerpt']['title']);
$this->assertEquals('', $loadedDocuments[1]->getExtensionsData()->toArray()['excerpt']['title']);
}

/**
@@ -199,24 +199,24 @@ public function testImport12XliffRU()
$this->assertEquals($import->successes, 2);

// structure
$this->assertEquals($loadedDocuments[0]->getTitle(), 'привет');
$this->assertEquals($loadedDocuments[1]->getTitle(), 'привет привет привет');
$this->assertEquals('привет', $loadedDocuments[0]->getTitle());
$this->assertEquals('привет привет привет', $loadedDocuments[1]->getTitle());

// path
$this->assertEquals($loadedDocuments[0]->getPath(), '/cmf/sulu_io/contents/parent');
$this->assertEquals($loadedDocuments[1]->getPath(), '/cmf/sulu_io/contents/child');
$this->assertEquals('/cmf/sulu_io/contents/parent', $loadedDocuments[0]->getPath());
$this->assertEquals('/cmf/sulu_io/contents/child', $loadedDocuments[1]->getPath());

// resource segment
$this->assertEquals($loadedDocuments[0]->getResourceSegment(), '/parent-ru-new-shit');
$this->assertEquals($loadedDocuments[1]->getResourceSegment(), '/child-ru-new-shit');
$this->assertEquals('/privet', $loadedDocuments[0]->getResourceSegment());
$this->assertEquals('/privet-privet-privet', $loadedDocuments[1]->getResourceSegment());

// seo
$this->assertEquals($loadedDocuments[0]->getExtensionsData()->toArray()['seo']['title'], '');
$this->assertEquals($loadedDocuments[1]->getExtensionsData()->toArray()['seo']['title'], 'SEO Title');
$this->assertEquals('', $loadedDocuments[0]->getExtensionsData()->toArray()['seo']['title']);
$this->assertEquals('SEO Title', $loadedDocuments[1]->getExtensionsData()->toArray()['seo']['title']);

// excerpt
$this->assertEquals($loadedDocuments[0]->getExtensionsData()->toArray()['excerpt']['title'], 'Excerpt title');
$this->assertEquals($loadedDocuments[1]->getExtensionsData()->toArray()['excerpt']['title'], '');
$this->assertEquals('Excerpt title', $loadedDocuments[0]->getExtensionsData()->toArray()['excerpt']['title']);
$this->assertEquals('', $loadedDocuments[1]->getExtensionsData()->toArray()['excerpt']['title']);
}

/**
@@ -245,13 +245,17 @@ private function prepareImportData()
$fs->copy($this->distPath, $this->path);

$distContent = file_get_contents($this->path, true);
$newContent = str_replace([
'%uuid_page_0%',
'%uuid_page_1%',
], [
$this->pages[0]->getUuid(),
$this->pages[1]->getUuid(),
], $distContent);
$newContent = str_replace(
[
'%uuid_page_0%',
'%uuid_page_1%',
],
[
$this->pages[0]->getUuid(),
$this->pages[1]->getUuid(),
],
$distContent
);

file_put_contents($this->path, $newContent);
} catch (IOExceptionInterface $e) {
@@ -262,13 +266,17 @@ private function prepareImportData()
$fs->copy($this->distPathRU, $this->pathRU);

$distContent = file_get_contents($this->pathRU, true);
$newContent = str_replace([
'%uuid_page_0%',
'%uuid_page_1%',
], [
$this->pages[0]->getUuid(),
$this->pages[1]->getUuid(),
], $distContent);
$newContent = str_replace(
[
'%uuid_page_0%',
'%uuid_page_1%',
],
[
$this->pages[0]->getUuid(),
$this->pages[1]->getUuid(),
],
$distContent
);

file_put_contents($this->pathRU, $newContent);
} catch (IOExceptionInterface $e) {
@@ -307,14 +315,16 @@ private function createSimplePage($title, $url)
$page->setLocale('en');
$page->setParent($this->homeDocument);
$page->setStructureType('simple');
$page->setExtensionsData([
'excerpt' => [
'title' => '',
'description' => '',
'categories' => [],
'tags' => [],
],
]);
$page->setExtensionsData(
[
'excerpt' => [
'title' => '',
'description' => '',
'categories' => [],
'tags' => [],
],
]
);

$this->documentManager->persist($page, 'en');

0 comments on commit dd99ea0

Please sign in to comment.