-1

After migrating my site from M1 to M2 everything is working but the customer grid. I have followed this- "Missing required argument $options" After migration from magento 1.9.2.4 to 2.1.3

Following those directions I add-

    echo '<pre>';
    print_r($attribute->getData());

Above -

/**
 * {@inheritdoc}
 */
public function getAttributeMetadata($attributeCode)
{
    /** @var AbstractAttribute $attribute */
    $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_CUSTOMER, $attributeCode);
    if ($attribute && ($attributeCode === 'id' || $attribute->getId() !== null)) {
        $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute);
        return $attributeMetadata;
    } else {
        throw new NoSuchEntityException(
            __(
                'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value',
                [
                    'fieldName' => 'entityType',
                    'fieldValue' => self::ENTITY_TYPE_CUSTOMER,
                    'field2Name' => 'attributeCode',
                    'field2Value' => $attributeCode
                ]
            )
        );

So it looks like-

echo '<pre>';
print_r($attribute->getData());
/**
 * {@inheritdoc}
 */
public function getAttributeMetadata($attributeCode)
{
    /** @var AbstractAttribute $attribute */
    $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_CUSTOMER, $attributeCode);
    if ($attribute && ($attributeCode === 'id' || $attribute->getId() !== null)) {
        $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute);
        return $attributeMetadata;
    } else {
        throw new NoSuchEntityException(
            __(
                'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value',
                [
                    'fieldName' => 'entityType',
                    'fieldValue' => self::ENTITY_TYPE_CUSTOMER,
                    'field2Name' => 'attributeCode',
                    'field2Value' => $attributeCode
                ]
            )
        );
    }
}

I then get-

 Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting function (T_FUNCTION) in /var/www/html/vendor/magento/module-customer/Model/Metadata/CustomerMetadata.php on line 68

What am I failing to see?

1

Try this. ECHO should be inside function. Not outside

/**
 * {@inheritdoc}
 */
public function getAttributeMetadata($attributeCode)
{
    /** @var AbstractAttribute $attribute */
    $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_CUSTOMER, $attributeCode);

    echo '<pre>';
    print_r($attribute->getData());

    if ($attribute && ($attributeCode === 'id' || $attribute->getId() !== null)) {
        $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute);
        return $attributeMetadata;
    } else {
        throw new NoSuchEntityException(
            __(
                'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value',
                [
                    'fieldName' => 'entityType',
                    'fieldValue' => self::ENTITY_TYPE_CUSTOMER,
                    'field2Name' => 'attributeCode',
                    'field2Value' => $attributeCode
                ]
            )
        );
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.