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

Updated Varien_Object::getData() and added getDataByKey() & getDataByPath() #4205

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

sreichel
Copy link
Contributor

Related Pull Requests

I wouldn't know where to start testing it, it's for sure ok but the getdata/setdata is such a core thing that a minor mistake will break everything and there are many use cases to test.
is it absolutely safe to merge it in main?

Current Varien_Object::getData() is 100% covered by unit tests:

phpunit-cc-varien-object

After that PR everything works as expected:

phpunit-cc-varien-object-new

It is safe to merge.

@github-actions github-actions bot added Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* labels Sep 18, 2024
@sreichel sreichel added the performance Performance related label Sep 18, 2024
Copy link
Contributor

@kiatng kiatng left a comment

Choose a reason for hiding this comment

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

Tested:

        $o = new Varien_Object([
            'a' => [
                'b' => [
                    'c' => 'value c'
                ]
            ],
            'key' => 'value',
            'lines' => "line1\nline2\nline3",
            'vo' => new Varien_Object([
                'a' => 'value a'
            ])
        ]);
        $result = [
            //'a' => $o->getData('a'),
            'a/b/c' => $o->getData('a/b/c'),
            'key' => $o->getData('key'),
            //'lines' => $o->getData('lines'),
            'line2' => $o->getData('lines', 1),
            //'vo' => $o->getData('vo'),
            'vo/a' => $o->getData('vo/a')
        ]

Result:

 array(4) {
  ["a/b/c"] => string(7) "value c"
  ["key"] => string(5) "value"
  ["line2"] => string(5) "line2"
  ["vo/a"] => string(7) "value a"
}

@sreichel sreichel merged commit 76148af into OpenMage:main Sep 18, 2024
17 checks passed
@sreichel sreichel deleted the m2-varien-object branch September 18, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* performance Performance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants