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

Fix ACL Forms #3746

Closed
wants to merge 3 commits into from
Closed

Fix ACL Forms #3746

wants to merge 3 commits into from

Conversation

mmft24
Copy link

@mmft24 mmft24 commented Apr 29, 2016

FormBuilder expects a string and not an object

FormBuilder expects a string and not an object
@@ -272,7 +272,7 @@ protected function buildForm(AdminObjectAclData $data, FormBuilderInterface $for
);
}

$formBuilder->add($key, new AclMatrixType(), array('permissions' => $permissions, 'acl_value' => $aclValue));
$formBuilder->add($key, AclMatrixType::class, array('permissions' => $permissions, 'acl_value' => $aclValue));
Copy link
Member

Choose a reason for hiding this comment

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

This won't work with old PHP versions.

Copy link
Contributor

@ju1ius ju1ius Apr 29, 2016

Choose a reason for hiding this comment

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

@core23 Wouldn't it be time to stop supporting 5.4? It's already long gone...

Copy link
Contributor

Choose a reason for hiding this comment

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

Bye bye array(array(array( 😆 )))

Copy link
Member

Choose a reason for hiding this comment

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

I am the last person who would support these old crap... But we use semver, so we must support it until the next major release.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use ::class and this should be good to merge.

@greg0ire
Copy link
Contributor

greg0ire commented Apr 29, 2016

@Turko : would you like to make this in a BC way ? Or do I mark this as "major" and schedule it for 4.0 ?

EDIT: this is totally doable in a BC way, I'm marking this as "patch".

@greg0ire greg0ire added the patch label Apr 29, 2016
@mmft24
Copy link
Author

mmft24 commented Apr 29, 2016

Hi, thank you for the fast feedback. I change it to be compatible to php 5.3.

Greetings

@@ -272,7 +271,7 @@ protected function buildForm(AdminObjectAclData $data, FormBuilderInterface $for
);
}

$formBuilder->add($key, new AclMatrixType(), array('permissions' => $permissions, 'acl_value' => $aclValue));
$formBuilder->add($key, 'Sonata\\AdminBundle\\Form\\Type\\AclMatrixType', array('permissions' => $permissions, 'acl_value' => $aclValue));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please linebreak this.

Copy link
Member

Choose a reason for hiding this comment

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

Double \ is not really necessary IMO and not used on the rest of the project.

@soullivaneuh
Copy link
Member

Hi, thank you for the fast feedback. I change it to be compatible to php 5.3.

The goal is not only to make it compatible to php 5.3 but compatible with older version of Symfony.

@mmft24
Copy link
Author

mmft24 commented May 6, 2016

I add some line breaks and a check auf sf major_version. Greetings.

@@ -271,8 +271,19 @@ protected function buildForm(AdminObjectAclData $data, FormBuilderInterface $for
'attr' => $attr,
);
}

$formBuilder->add($key, new AclMatrixType(), array('permissions' => $permissions, 'acl_value' => $aclValue));
if (3 < Kernel::MAJOR_VERSION) {
Copy link
Member

Choose a reason for hiding this comment

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

Is the kernel version safe enough as a check?

Copy link
Member

Choose a reason for hiding this comment

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

Absolutly not. This is from the Kernel component and we are working with the form one.

@Turko Please use method_exists.

@soullivaneuh
Copy link
Member

Please also rebase to have StyleCI green.

@soullivaneuh
Copy link
Member

According to the new Sonata version management and next major release plan, this project has been refactored regarding branching and versioning.

If you see this message, your PR concerns a patch or a minor release and is not targeting the right branch.

So I'm closing this one, but don't see it as a refusal. If you think your work is still relevant and want to continue, feel free to reopen it on the right branch (e.g. the default one).

Regards.

@mmft24
Copy link
Author

mmft24 commented May 9, 2016

Hi Guys, sorry, but I don't see a way to do this check with out checking the kernel. I understand, that symfony forms are not depending on the kernel, but I didn't find a better way. We are talking about a breaking change in Symfony Forms that now expects a string where before it expected an Object (as a second param). I don't see how method_exists can help me on this one. I really believe that you should carefully evaluate if you want to support in version 3.x symfony 2.3.
I will do a rebase to get the styleCI.

@soullivaneuh
Copy link
Member

I understand, that symfony forms are not depending on the kernel, but I didn't find a better way.

Here a sample of method_exists usage:

method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') ?

I really believe that you should carefully evaluate if you want to support in version 3.x symfony 2.3.

See discussion here: sonata-project/dev-kit#51

I will do a rebase to get the styleCI.

Don't forget to rebase and open another PR for 3.x branch. 👍

@mmft24 mmft24 deleted the patch-1 branch May 9, 2016 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants