Skip to content

Commit

Permalink
Revert "Fix compatibility with sulu 2.0 field descriptors and mysql u…
Browse files Browse the repository at this point in the history
…tf8mb4 (#159)"

This reverts commit 89bbbed.
  • Loading branch information
alexander-schranz committed Apr 25, 2018
1 parent 46e30c6 commit ff5fe44
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 59 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ cache:

matrix:
include:
- php: 7.1
- php: 5.5
env:
- COMPOSER_FLAGS="--prefer-dist --no-interaction --prefer-lowest"
- php: 7.2
- COMPOSER_FLAGS="--prefer-dist --no-interaction" # --prefer-lowest TODO FIXME sulu 1.3 issue
- php: 7.0
env:
- COMPOSER_FLAGS="--prefer-dist --no-interaction"
- CODE_COVERAGE=true
Expand Down
13 changes: 8 additions & 5 deletions Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineDescriptor;
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor;
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineJoinDescriptor;
use Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface;
use Sulu\Component\Rest\ListBuilder\ListRepresentation;
use Sulu\Component\Rest\RestHelperInterface;
use Sulu\Component\Security\SecuredControllerInterface;
Expand Down Expand Up @@ -64,7 +63,8 @@ public function getFieldDescriptors($locale, $filters)
Form::class,
'public.id',
[],
FieldDescriptorInterface::VISIBILITY_NO
true,
false
);

$fieldDescriptors['title'] = new DoctrineCaseFieldDescriptor(
Expand Down Expand Up @@ -92,7 +92,8 @@ public function getFieldDescriptors($locale, $filters)
]
),
'public.title',
FieldDescriptorInterface::VISIBILITY_ALWAYS
false,
true
);

$fieldDescriptors['changed'] = new DoctrineCaseFieldDescriptor(
Expand Down Expand Up @@ -120,7 +121,8 @@ public function getFieldDescriptors($locale, $filters)
]
),
'public.changed',
FieldDescriptorInterface::VISIBILITY_NO
false,
false
);

$fieldDescriptors['created'] = new DoctrineCaseFieldDescriptor(
Expand Down Expand Up @@ -148,7 +150,8 @@ public function getFieldDescriptors($locale, $filters)
]
),
'public.created',
FieldDescriptorInterface::VISIBILITY_NO
false,
false
);

return $fieldDescriptors;
Expand Down
7 changes: 4 additions & 3 deletions ListBuilder/DynamicListFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Sulu\Bundle\FormBundle\Entity\Dynamic;
use Sulu\Bundle\FormBundle\Entity\Form;
use Sulu\Component\Rest\ListBuilder\FieldDescriptor;
use Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface;

/**
* Create FieldDescription from a form entity.
Expand Down Expand Up @@ -63,7 +62,8 @@ public function getFieldDescriptors(Form $form, $locale)
$fieldDescriptors[$field->getKey()] = new FieldDescriptor(
$field->getKey(),
$title,
FieldDescriptorInterface::VISIBILITY_YES,
false,
true,
'',
'',
'',
Expand All @@ -74,7 +74,8 @@ public function getFieldDescriptors(Form $form, $locale)
$fieldDescriptors['created'] = new FieldDescriptor(
'created',
'sulu_form.created',
FieldDescriptorInterface::VISIBILITY_YES,
false,
true,
'datetime'
);

Expand Down
14 changes: 7 additions & 7 deletions Provider/DynamicProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Sulu\Bundle\FormBundle\Entity\Dynamic;
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor;
use Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface;

class DynamicProvider implements ListProviderInterface
{
Expand All @@ -28,9 +27,9 @@ public function getFieldDescriptors($webspace, $locale, $uuid)
);

$fieldDescriptors = [
'id' => $this->createFieldDescriptor('id', '', 'public.id', FieldDescriptorInterface::VISIBILITY_NO),
'uuid' => $this->createFieldDescriptor('uuid', '', 'uuid', FieldDescriptorInterface::VISIBILITY_NO),
'webspaceKey' => $this->createFieldDescriptor('webspaceKey', '', 'webspaceKey', FieldDescriptorInterface::VISIBILITY_NO),
'id' => $this->createFieldDescriptor('id', '', 'public.id'),
'uuid' => $this->createFieldDescriptor('uuid', '', 'uuid', true),
'webspaceKey' => $this->createFieldDescriptor('webspaceKey', '', 'webspaceKey', true),
'locale' => $this->createFieldDescriptor('locale', '', 'locale'),
'firstName' => $this->createFieldDescriptor('firstName'),
'lastName' => $this->createFieldDescriptor('lastName'),
Expand All @@ -53,11 +52,11 @@ public function getFieldDescriptors($webspace, $locale, $uuid)
* @param string $name
* @param string $type
* @param string $translationKey
* @param string $visibility
* @param bool $disabled
*
* @return DoctrineFieldDescriptor
*/
protected function createFieldDescriptor($name, $type = '', $translationKey = '', $visibility = FieldDescriptorInterface::VISIBILITY_YES)
protected function createFieldDescriptor($name, $type = '', $translationKey = '', $disabled = false)
{
if (!$translationKey) {
$translationKey = 'sulu_form.type.' . strtolower($name);
Expand All @@ -69,7 +68,8 @@ protected function createFieldDescriptor($name, $type = '', $translationKey = ''
Dynamic::class,
$translationKey,
[],
$visibility,
$disabled,
false,
$type
);
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/doctrine/FormField.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<generator strategy="AUTO"/>
</id>

<field name="key" column="keyName" type="string" length="128"/>
<field name="key" column="keyName" type="string" length="255"/>
<field name="order" column="orderNumber" type="integer"/>
<field name="type" column="type" type="string" length="255"/>
<field name="width" column="width" type="string" length="16"/><!-- full / half / one-third / two-third / quarter -->
Expand Down
2 changes: 1 addition & 1 deletion Tests/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ public function registerContainerConfiguration(LoaderInterface $loader)
{
parent::registerContainerConfiguration($loader);

$loader->load(__DIR__ . '/config/config.yml');
$loader->load(__DIR__ . '/config/config_' . $this->getContext() . '.yml');
}
}
26 changes: 0 additions & 26 deletions Tests/app/config/config.yml

This file was deleted.

5 changes: 5 additions & 0 deletions Tests/app/config/config_admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
secret: test

framework:
router: { resource: "%kernel.root_dir%/config/routing_admin.yml" }
16 changes: 16 additions & 0 deletions Tests/app/config/config_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
secret: test

framework:
esi: ~
router: { resource: '%kernel.root_dir%/config/routing_website.yml' }
profiler: { only_exceptions: false }
fragments: ~

sulu_form:
mail:
from: "[email protected]"
to: "[email protected]"

swiftmailer:
disable_delivery: true
File renamed without changes.
Empty file.
10 changes: 0 additions & 10 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Upgrade

## 2.0.0 (unreleased)

### UTF8MB4 compatibility

The field `keyName` need to be short to 128 length for UTF8MB4 compatibility:

```sql
ALTER TABLE fo_form_fields CHANGE keyName keyName VARCHAR(128) NOT NULL;
```

## 1.0.0-RC3

### Removed `dynamic_default_view` parameter
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"description": "Bundle for creating forms in Sulu.",
"type": "sulu-bundle",
"require": {
"symfony/symfony": "^3.4",
"symfony/symfony": "^2.8.7 || ^3.0",
"symfony/swiftmailer-bundle": "^2.3 || ^3.0",
"doctrine/orm": "~2.5.3",
"php": "^7.1",
"php": "^5.5 || ^7.0",
"twig/twig": "^1.26 || ^2.0",
"sulu/sulu": "dev-develop"
"sulu/sulu": "~1.3"
},
"require-dev": {
"jackalope/jackalope-doctrine-dbal": "^1.2.5",
Expand Down

0 comments on commit ff5fe44

Please sign in to comment.