Skip to content

Commit 5e9280c

Browse files
committed
Hox fix for es 5
1 parent 8e7a273 commit 5e9280c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

Controller/ContentManagement/FileController.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
use EMS\CoreBundle\Controller\AppController;
66
use EMS\CoreBundle;
77
use EMS\CoreBundle\Entity\UploadedAsset;
8-
use EMS\CoreBundle\Repository\UploadedAssetRepository;
9-
use Elasticsearch\Common\Exceptions\Conflict409Exception;
108
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
119
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
1210
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
13-
use Symfony\Component\HttpFoundation\JsonResponse;
14-
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
16-
use Doctrine\ORM\EntityManager;
1711
use Symfony\Component\HttpFoundation\BinaryFileResponse;
12+
use Symfony\Component\HttpFoundation\Request;
1813
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
14+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1915

2016
class FileController extends AppController
2117
{

Form/DataField/DataLinkFieldType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public static function getIcon(){
9797
*/
9898
public static function buildObjectArray(DataField $data, array &$out) {
9999
if (! $data->getFieldType ()->getDeleted ()) {
100-
if($data->getFieldType()->getDisplayOptions()['multiple']){
100+
$options = $data->getFieldType()->getDisplayOptions();
101+
if(isset($options['multiple']) && $options['multiple']){
101102
$out [$data->getFieldType ()->getName ()] = $data->getArrayTextValue();
102103
}
103104
else{

Form/Form/ContentTypeType.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) {
3333
'firstLevelOnly' => true,
3434
'mapping' => $mapping,
3535
'types' => [
36+
'text',
3637
'string',
3738
'integer'
3839
]]);
@@ -43,27 +44,31 @@ public function buildForm(FormBuilderInterface $builder, array $options) {
4344
'mapping' => $mapping,
4445
'types' => [
4546
'string',
47+
'text',
4648
]]);
4749
$builder->add ( 'circlesField', ContentTypeFieldPickerType::class, [
4850
'required' => false,
4951
'firstLevelOnly' => true,
5052
'mapping' => $mapping,
5153
'types' => [
5254
'string',
55+
'text',
5356
]]);
5457
$builder->add ( 'emailField', ContentTypeFieldPickerType::class, [
5558
'required' => false,
5659
'firstLevelOnly' => true,
5760
'mapping' => $mapping,
5861
'types' => [
5962
'string',
63+
'text',
6064
]]);
6165
$builder->add ( 'categoryField', ContentTypeFieldPickerType::class, [
6266
'required' => false,
6367
'firstLevelOnly' => true,
6468
'mapping' => $mapping,
6569
'types' => [
6670
'string',
71+
'text',
6772
]]);
6873
$builder->add ( 'imageField', ContentTypeFieldPickerType::class, [
6974
'required' => false,
@@ -85,6 +90,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) {
8590
'mapping' => $mapping,
8691
'types' => [
8792
'string',
93+
'text',
8894
'integer',
8995
'text',
9096
'keyword'

Service/ContentTypeService.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ public function updateMapping(ContentType $contentType, $envs=false){
146146

147147
} catch ( BadRequest400Exception $e ) {
148148
$contentType->setDirty ( true );
149-
$message = json_decode($e->getPrevious()->getMessage(), true);
150-
$this->session->getFlashBag()->add ( 'error', '<p><strong>You should try to rebuild the indexes</strong></p>
149+
$message = json_decode($e->getMessage(), true);
150+
if(!empty($e->getPrevious())) {
151+
$message = json_decode($e->getPrevious()->getMessage(), true);
152+
}
153+
$this->session->getFlashBag()->add ( 'error', '<p><strong>You should try to rebuild the indexes for '.$contentType->getName().'</strong></p>
151154
<p>Message from Elasticsearch: <b>' . $message['error']['type']. '</b>'.$message['error']['reason'] . '</p>' );
152155
}
153156
}

0 commit comments

Comments
 (0)