src/Shell/ImportShell.php
protected function _findListValue(RepositoryInterface $table, string $listName, string $value) : string
    {
        $options = FieldUtility::getList(sprintf('%s.%s', $table->getAlias(), $listName), true);

        // check against list options values
        foreach ($options as $val => $params) {
            if ($val !== $value) {
                continue;
            }

            return $val;
        }

        // check against list options labels
        foreach ($options as $val => $params) {
            if ($params['label'] !== $value) {
                continue;
            }

            return $val;
        }

        return $value;
    }
protected function _findListValue(RepositoryInterface $table, string $listName, string $value) : string
    {
        $options = FieldUtility::getList(sprintf('%s.%s', $table->getAlias(), $listName), true);

        // check against list options values
        foreach ($options as $val => $params) {
            if ($val !== $value) {
                continue;
            }

            return $val;
        }

        // check against list options labels
        foreach ($options as $val => $params) {
            if ($params['label'] !== $value) {
                continue;
            }

            return $val;
        }

        return $value;
    }
protected function _findListValue ( RepositoryInterface $ table , string $ listName , string $ value ) : string { $ options = FieldUtility :: getList ( sprintf ( '%s.%s' , $ table -> getAlias ( ) , $ listName ) , true ) ; // check against list options values foreach ( $ options as $ val => $ params ) { if ( $ val !== $ value ) { continue ; } return $ val ; } // check against list options labels foreach ( $ options as $ val => $ params ) { if ( $ params [ 'label' ] !== $ value ) { continue ; } return $ val ; } return $ value ; }
Fetch list value.

First will try to find if the row value matches one
of the list options.

@param \Cake\Datasource\RepositoryInterface $table Table instance
@param string $listName List name
@param string $value Field value
@return string
Fetch list value .