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

#6131 #6196

Closed
wants to merge 1 commit into from
Closed

#6131 #6196

wants to merge 1 commit into from

Conversation

aleksanderd
Copy link
Contributor

Closes #6131

@samdark
Copy link
Member

samdark commented Nov 24, 2014

#6131

@qiangxue
Copy link
Member

Would you help add some unit tests? InflectorTest::testCamel2id()?

@qiangxue qiangxue added this to the 2.0.x milestone Nov 24, 2014
@RusAlex
Copy link
Contributor

RusAlex commented Nov 24, 2014

Do you have any naming convetion ? maybe $result could be better here.
$return is not good imho

@samdark
Copy link
Member

samdark commented Nov 24, 2014

Yes, $result is better.

@cebe
Copy link
Member

cebe commented Nov 24, 2014

Isn't this change breaking BC? What am I missing?

@samdark
Copy link
Member

samdark commented Nov 24, 2014

I think it is.

@qiangxue
Copy link
Member

I think we can take this change because the existing code turns Post[1] into Post[1], which isn't a valid ID anyway. So this change is more like fixing a previously undefined/improper result.

@samdark
Copy link
Member

samdark commented Nov 24, 2014

Technically it is valid in HTML5 but it's not a good practice because of JS and CSS issues with such IDs. Agree that it's more like a fix.

@cebe
Copy link
Member

cebe commented Nov 24, 2014

but if it is valid in HTML5 it generated valid ids before so changing it may break code that was relying on the ids...

@qiangxue
Copy link
Member

Any suggestion? Or perhaps we can let it slip in the release since it's very unlikely that someone would use such IDs...

@qiangxue
Copy link
Member

Also Post[1] is not a valid camelcase word either...

@samdark
Copy link
Member

samdark commented Nov 24, 2014

Why it replaces [] only then and not everything that is not valid?

@qiangxue
Copy link
Member

Yes, it could.

@aleksanderd
Copy link
Contributor Author

I written before I not sure how to make this. I just needed a tool to make IDs from long names in my custom widgets. There is Html::getInputId, but it accepts $model+$attribute so I can not use a ready $name to get $id. For me it is enough just to have separated function which not depend on a model.

camel2id seems to be ok too, but now I not sure what and how other invalid chars must be replaced, and more matters is that Post[1] is not camel, so even function name will be wrong...

@aleksanderd
Copy link
Contributor Author

btw, what is BC? :)

@alex-code
Copy link
Contributor

BC means backwards compatibility.

@aleksanderd
Copy link
Contributor Author

thnx Alex! :)

what about to introduce name2camel()?
for my case it will be used like camel2id(name2camel($name))

@klimov-paul
Copy link
Member

Should not Inflector::slug() should be used here?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c27a5f7 on flyiing:6131-dumb into * on yiisoft:master*.

@SilverFire
Copy link
Member

Seems to be outdated. Agreed with @klimov-paul

@SilverFire SilverFire closed this Sep 16, 2016
@cebe cebe removed this from the 2.0.x milestone Sep 16, 2016
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.

Html::name2id
9 participants