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

Use Underscore.php #559

Closed
colinmollenhour opened this issue Apr 23, 2014 · 4 comments
Closed

Use Underscore.php #559

colinmollenhour opened this issue Apr 23, 2014 · 4 comments

Comments

@colinmollenhour
Copy link

PHP lacks a lot when it comes to syntax sugar, especially when working with arrays. Maybe someday this will be addressed (PHP 6?), but in the meantime there are useful tools to work around these shortcomings. One such tool is Underscore.php which is a PHP port of underscore.js.

One simple example:

$options = array(
  array('label' => 'Foo', 'value' => 'foo'),
  array('label' => 'Foo', 'value' => 'foo'),
);

// PHP standard
$values = array();
foreach ($options as $option) {
  $values = $option['value'];
}

// Underscore.php
$values = __::pluck($options, 'value');

Sure, one can include this in their own code, but by including it in core it prevents conflicts and ensures that using it is "ok". Also it could be used to clean up some existing core code.

http://brianhaveri.github.io/Underscore.php/

Just a thought. ;)

@verklov
Copy link
Contributor

verklov commented Apr 23, 2014

@colinmollenhour, thank you for a suggestion! I will ask architects to look at the suggested improvement and let you know of the decision taken.

@verklov verklov self-assigned this Apr 23, 2014
@TexanHogman
Copy link

@colinmollenhour -- good suggestion but we did not rework any core code to leverage underscore in our platform work for the initial M2 release. As you mentioned community can be innovative now and we'll consider core changes post 2.0.

@Vinai
Copy link
Contributor

Vinai commented Jan 10, 2015

👍

@vpelipenko
Copy link
Contributor

@colinmollenhour, as it was mentioned by @TexanHogman 'underscore' is not in our nearest plans.

magento-team pushed a commit that referenced this issue Aug 31, 2015
magento-team pushed a commit that referenced this issue Apr 24, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
[Performance] Fast Display and Generation of Product Variations
- MAGETWO-55300 [Customer] Fast Display and Generation of Product Variations for Configurable Products
fe-lix- pushed a commit to fe-lix-/magento2 that referenced this issue Apr 6, 2018
…es_disabled

 magento#451 disabled sources tab content on manage_stock update
magento-devops-reposync-svc pushed a commit that referenced this issue Sep 8, 2023
ACPT-1523: Fix Static test failures on application-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants