Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-29104: Impl. ImageAsset field type #246

Merged
merged 8 commits into from
Sep 11, 2018

Conversation

adamwojs
Copy link
Member

@adamwojs adamwojs commented Jul 26, 2018

JIRA: https://jira.ez.no/browse/EZP-29104
Depends on ezsystems/ezpublish-kernel#2403

Description

Impl. of \EzSystems\RepositoryForms\FieldType\FieldDefinitionFormMapperInterface and \EzSystems\RepositoryForms\FieldType\FieldValueFormMapperInterface for Image Asset Field Type.

@adamwojs adamwojs force-pushed the EZP-29104-imageasset_clean branch from 4cb73fc to c41b7e6 Compare July 27, 2018 09:20
@adamwojs adamwojs changed the title [WIP] EZP-29104: Impl. ImageAsset field type EZP-29104: Impl. ImageAsset field type Jul 27, 2018
public function transform($value)
{
if (!$value instanceof Value) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it more future proof I'd rather return null for $value = null but for !$value instanceof Value it should throw \Symfony\Component\Form\Exception\TransformationFailedException.

$this->fieldTypeService = $fieldTypeService;
}

public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to implement FieldDefinitionFormMapperInterface and define empty method. It should work without these.

class ImageAssetFieldType extends AbstractType
{
/** @var \eZ\Publish\API\Repository\ContentService */
private $contentService;

This comment was marked as resolved.

{
$builder
->add(
'destinationContentId',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: no need to make it multiline


class ImageAssetValueTransformer extends AbstractBinaryBaseTransformer implements DataTransformerInterface
{
public function transform($value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about docblock and return type hint here and reverseTransform()?

/** @var \eZ\Publish\API\Repository\FieldTypeService */
private $fieldTypeService;

public function __construct(FieldTypeService $fieldTypeService)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docblocks?

@adamwojs
Copy link
Member Author

adamwojs commented Aug 2, 2018

PR updated according to @webhdx @mikadamczyk suggestions.

@adamwojs
Copy link
Member Author

adamwojs commented Aug 3, 2018

PR ready for the final code review @mikadamczyk @webhdx

<?php

/**
* This file is part of the eZ Publish Kernel package.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a part of the Kernel package. We can add declare(strict_types=1);


class SelectionOption extends ValueObject
{
public $isDefault;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dockblock and an empty line between properties


EzSystems\RepositoryForms\FieldType\Mapper\ImageAssetFormMapper:
tags:
- { name: ez.fieldFormMapper.definition, fieldType: ezimageasset }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ez.fieldFormMapper.definition is not needed as the class is not implementing FieldDefinitionFormMapperInterface

@barbaragr barbaragr self-assigned this Aug 22, 2018
@adamwojs adamwojs force-pushed the EZP-29104-imageasset_clean branch from 8457386 to a503d1e Compare September 10, 2018 13:01
Copy link

@barbaragr barbaragr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge @alongosz

@alongosz alongosz merged commit 22d9d75 into ezsystems:master Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants