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

Improved helper function getModelName() #1031

Merged
merged 1 commit into from
Dec 30, 2015

Conversation

jeroenvermeulen
Copy link
Contributor

The function Mage::helper('turpentine/data')->getModelName($product); did not work in case an extension used in config.xml:

    <models>
        <mygroupname>
            <class>MyPackage_MyExtension_Model</class>
        <mygroupname>
        <catalog>
            <rewrite>
                <product>MyPackage_MyExtension_Model_Product</product>
            </rewrite>
        </catalog>
    </models>

Because then the class guessed by getModelName($product) was myextension/product while it should be mygroupname/product.
I made the function check if the guessed value is a valid model name.
If not valid: the right value is quite hard to look up, so I decided to return the full class name, MyPackage_MyExtension_Model_Product in this example.

It did not work in case an extension used in config.xml:
    <models>
        <mygroupname>
            <class>MyPackage_MyExtension_Model</class>
        <mygroupname>
    </models>
Because then the class guessed by getModelName($product) is:
`myextension/product` while it should be `mygroupname/product`.
I made the function check if the guess is a valid model. If not: the right value is quite hard to look up, so I decided to return `MyPackage_MyExtension_Model_Product` in this example.
@jeroenvermeulen
Copy link
Contributor Author

@miguelbalparda Did you get a chance to look at this PR?

@miguelbalparda
Copy link
Contributor

@jeroenvermeulen yes we are looking to merge this no later than this week. Thank you for your contribution!

miguelbalparda added a commit that referenced this pull request Dec 30, 2015
Improved helper function getModelName()
@miguelbalparda miguelbalparda merged commit c1f3f95 into nexcess:devel Dec 30, 2015
@miguelbalparda
Copy link
Contributor

Thank you for your contribution!

@jeroenvermeulen jeroenvermeulen deleted the bugfix/getModelName branch May 24, 2017 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants