Problem/Motivation

Symfony string inflector is buggy...

Several examples:

use Symfony\Component\String\Inflector\EnglishInflector;
$inflector = new EnglishInflector();
$inflector->pluralize('coupon'); // This returns "coupa".
$inflector->pluralize('coupons'); // This will return "couponss".

I tried the same with the Doctrine inflector, which we stopped using as part of #3117772: Doctrine\Common\Inflector\Inflector no longer in D9 and I got the expected results (i.e "coupons") for both strings).

My proposal is to switch back to using the Doctrine inflector, and require that directly.

The main issue this is causing is the promotion--coupons relationship that's being renamed to "promotion-coupa"...

Comments

jsacksick created an issue. See original summary.

jsacksick’s picture

Title: Switch back to relying on the doctrine Inflector » Switch back to relying the doctrine Inflector library

Doctrine Inflector has a 2.x branch, which requires php 7.2 at least. I'm not sure we can actually require the 1.x branch as it could potentially create conflicts with other dependencies...

jsacksick’s picture

Status: Active » Needs review
StatusFileSize
new4.85 KB
jsacksick’s picture

StatusFileSize
new4.98 KB
jsacksick’s picture

Status: Needs review » Needs work

Wondering if we shouldn't come up with our own inflector logic... as we don't need fancyness and simply need to append a "s" for commerce entity types and don't really need to care about english pluralization.

jsacksick’s picture

Title: Switch back to relying the doctrine Inflector library » The symfony inflector library is not pluralizing certain words correctly
Status: Needs work » Needs review
StatusFileSize
new4.95 KB

To avoid potential version conflicts with different versions of core, I decided to try out a different library, let's see if the tests pass!

jsacksick’s picture

StatusFileSize
new4.99 KB
jsacksick’s picture

StatusFileSize
new4.82 KB
jsacksick’s picture

StatusFileSize
new4.89 KB

Coding standard fixes.

  • jsacksick committed 5f7ac0d on 8.x-1.x
    Issue #3188714 by jsacksick: Fix pluralization issues by requiring a...
jsacksick’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.