Skip to content

Commit

Permalink
fix content create/update mig gen for ezpl 1 and later
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Jan 7, 2021
1 parent 5b91b03 commit ff80556
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Core/FieldHandler/EzBinaryFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public function fieldValueToHash($fieldValue, array $context = array())
if ($fieldValue->uri == null) {
return null;
}

$binaryFile = $this->ioService->loadBinaryFile($fieldValue->id);
return array(
'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->uri),
'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($binaryFile->uri) : $binaryFile->uri),
'filename'=> $fieldValue->fileName,
'mimeType' => $fieldValue->mimeType
);
Expand Down
4 changes: 2 additions & 2 deletions Core/FieldHandler/EzMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public function fieldValueToHash($fieldValue, array $context = array())
if ($fieldValue->uri == null) {
return null;
}

$binaryFile = $this->ioService->loadBinaryFile($fieldValue->id);
return array(
'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->uri),
'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($binaryFile->uri) : $fieldValue->uri),
'filename'=> $fieldValue->fileName,
'mime_type' => $fieldValue->mimeType,
'has_controller' => $fieldValue->hasController,
Expand Down
4 changes: 3 additions & 1 deletion Core/FieldHandler/FileFieldHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ class FileFieldHandler extends AbstractFieldHandler
{
protected $ioRootDir;
protected $ioDecorator;
protected $ioService;

public function __construct($ioRootDir, UrlDecorator $ioDecorator=null)
public function __construct($ioRootDir, UrlDecorator $ioDecorator=null, $ioService=null)
{
$this->ioRootDir = $ioRootDir;
$this->ioDecorator = $ioDecorator;
$this->ioService = $ioService;
}
}
2 changes: 2 additions & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ services:
arguments:
- "$io.root_dir$"
- "@?ezpublish.core.io.prefix_url_decorator"
- "@?ezpublish.fieldType.ezbinaryfile.io_service"
tags:
- { name: ez_migration_bundle.complex_field, fieldtype: ezbinaryfile, priority: 0 }

Expand Down Expand Up @@ -693,6 +694,7 @@ services:
arguments:
- "$io.root_dir$"
- "@?ezpublish.core.io.prefix_url_decorator"
- "@?ezpublish.fieldType.ezbinaryfile.io_service"
tags:
- { name: ez_migration_bundle.complex_field, fieldtype: ezmedia, priority: 0 }

Expand Down
7 changes: 5 additions & 2 deletions WHATSNEW.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Version 5.xx (unreleased)
=========================
Version 5.15.0
==============

* New: it is now possible to dump all of a content's languages when generating `content/create` and `content/update`
migrations. In order to do so, pass `--lang=all` on the command line

* Fixed: allow usage of shorthand notation when setting references in `file` migration steps

* Fixed: generating `content/create` and `content/update` migrations would fail with eZPlatform 1 and later for any
contents with non-null ezbinaryfile and ezmedia fields


Version 5.14.0
==============
Expand Down

0 comments on commit ff80556

Please sign in to comment.