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

Document interface method #3959

Merged

Conversation

greg0ire
Copy link
Contributor

Subject

This should give a better idea of what this method is supposed to be
doing.

@@ -22,8 +22,11 @@
interface BuilderInterface
{
/**
* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* Adds missing information to the given field description from the model manager metadata,
Copy link
Contributor

@ju1ius ju1ius Jun 17, 2016

Choose a reason for hiding this comment

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

Don't think the information is actually missing.
Isn't it more that the builder adds additional information, mainly for building the view ?
Are there cases where the FieldDescription is constructed outside ModelManager::getNewFieldDescriptionInstance() ? I couldn't find any.
Or is it that the metadata can change between when the FieldDescription is constructed and the time it is passed to this method ?

Copy link
Contributor Author

@greg0ire greg0ire Jun 17, 2016

Choose a reason for hiding this comment

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

Isn't it more that the builder adds additional information, mainly for building the view ?

Not sure the field description can be properly used in the view without this method being executed. Regarding your other questions… help @rande !

Copy link
Contributor

Choose a reason for hiding this comment

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

@greg0ire Yep I think you're right.
What trips me up is that ModelManager::getNewFieldDescriptionInstance() populates the FieldDescription with metadata, then BuilderInterface::fixFieldDescription() populates it again...

Copy link
Contributor

@ju1ius ju1ius Jun 17, 2016

Choose a reason for hiding this comment

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

Ok I think I get it now...
FormContractor implements BuilderInterface but it's not a real builder like the other builders. It is more like a middle-man between the FormMapper and the "real" Symfony FormBuilder, so the FormMapper needs to call methods on it.
I think this method belongs in fact to the FormContractorInterface, because it can be private to the other "normal" builders as no one calls it from the outside.
Isn't it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a middle-man between the FormMapper and the "real" Symfony FormBuilder

Hence the word "contractor", maybe ?

I think this method belongs in fact to the FormContractorInterface, because it can be private to the other "normal" builders as no one calls it from the outside.

Should we make it private then? If yes, it should be removed from the interface, shouldn't it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per the rest of the answer, I think I need to read some code before I can understand it, I'll try to do that soon.

Copy link
Contributor

@ju1ius ju1ius Jun 20, 2016

Choose a reason for hiding this comment

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

what a "real" builder is

The DatagridBuilder, ListBuilder & ShowBuilder concrete implementations, i.e SonataDoctrineORMAdminBundle\Builder\ListBuilder et al.

In short the fixFieldDescription method is needed only on the FormContractorInterface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@ju1ius ju1ius Jun 24, 2016

Choose a reason for hiding this comment

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

getDefaultOptions has some differences.

I guess this is mostly for historical reasons, i.e. changes not being systematically ported to all bundles.
The phpcr admin bundle is the only one having meaningful differences (outside the underlying metadata implementation details I mean).

That's why I proposed an AbstractFormContractor class in #3971

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol there is a __construct() method in FormContractorInterface

@greg0ire greg0ire force-pushed the fix_field_description_doc branch 3 times, most recently from 87c20a1 to 3d28da6 Compare June 24, 2016 20:47
@soullivaneuh
Copy link
Member

What is the state of this PR @greg0ire? Anything else to do?

* @param AdminInterface $admin
* @param FieldDescriptionInterface $fieldDescription
* Adds missing information to the given field description from the model manager metadata,
* and the given admin.
Copy link
Member

Choose a reason for hiding this comment

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

Please keep it one-lined. This is under 120 chars.

This should give a better idea of what this method is supposed to be
doing.
@greg0ire
Copy link
Contributor Author

greg0ire commented Jul 5, 2016

What is the state of this PR @greg0ire? Anything else to do?

Nope. You can merge that IMO.

@soullivaneuh soullivaneuh merged commit 2674406 into sonata-project:3.x Jul 5, 2016
@soullivaneuh
Copy link
Member

Thank you @greg0ire

@soullivaneuh soullivaneuh removed the RTM label Jul 5, 2016
@greg0ire greg0ire deleted the fix_field_description_doc branch July 5, 2016 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants