Magento2: Missing class in develop branch (Media.php)

Created on 22 Dec 2015  路  15Comments  路  Source: magento/magento2

Got Class Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media does not exist. Found out that in develop branch it is missing. please do the needful.

Catalog Format is not valid Ready for Work bug report non-issue

Most helpful comment

But I don't want quick and hacky workarounds, I want sustainable solutions so that I don't need to worry about it in the future.

All 15 comments

@mudithae Can you provide a full stack-trace for this error and also details on your environment and what steps you went through to install the software?

Hi
I got the same issue installing sampleData
magento sampledata:deploy is successful but magento setup:upgrade fails :
Module 'Magento_CatalogSampleData':

[ReflectionException]
Class Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media does not exist

[ReflectionException]
Class Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Media does not exist

And there's no Media.php :
-bash-4.3$ ls app/code/Magento/Catalog/Model/ResourceModel/Product/Attribute/Backend/
GroupPrice/ Image.php Tierprice.php

For information I had to add this in my composer.json to make deploy work :
"repositories": [
{
"type": "composer",
"url": "http://packages.magento.com/"
}
]

Hi @davidalger,

Sorry for delay in reply. I have missed your previous email somehow.

Yes, for me also it occurs when I install the sample data (Install the Magento first Sample data next).

Still I can see that in branch 2.0 below is exists but not in develop branch.
magento2/app/code/Magento/Catalog/Model/ResourceModel/Product/Attribute/Backend/Media.php

Regards,
Muditha

Hey, I am getting same error when I am trying to install with sample data. In my case, I have already install sample-data using the command magento sampledata:deploy and then tried to install magento2 like magento setup:install --use-sampledata, but leads to the same error.

I checked and that file is not there. Also I have following configuration in my composer.json

"repositories": [
{
     "type": "composer",
     "url": "http://packages.magento.com/"
}

What should I do in this case ?

Thank you all for your contribution.
Internal ticket has been created: MAGETWO-47646

Hello @mudithae, @jedjebari
Try to setup Sample Data from GitHub: https://github.com/magento/magento2-sample-data#deploy-sample-data-from-github-repository
Or if you want to setup with composer you need to set correct version for Sample Data package

Note, that for stable version for example 2.0.1 you can simple run bin/magento sampledata:deploy command

Hi all, documentation should be updated soon. I have had this issue as well. Meanwhile, you should be able to use this readme which is in the sample data GitHub repo.

Hi All,

Thanks for your contribution to resolve this. I think with the @katmoon, @mslabko and @xcomSteveJohnson replies I can consider this this as solved.

Regards,
Muditha

I also have this problem. Why did you close this issue @mudithae ?
Sure, maybe the alternative method to install sample data works, but that does not mean that the issue is fixed, it's only a workaround. This is a documented method and it does not work, so there should be an open issue about it.

I want to use this method. It's much more convenient for automated installations. The documentation says this works. But it fails. Please fix it!

Hi @pantaoran,

Your point is valid. I will reopen the issue.

Regards,
Muditha

BTW, as a quick and hacky workaround, copying the Media.php file from the 2.0 branch during the installation of the sample data, works.

But I don't want quick and hacky workarounds, I want sustainable solutions so that I don't need to worry about it in the future.

@pantaoran
First, I added that comment for others mainly who might stuble over this thread via google.
Second, the issue is already solved: once the release version of Magento matches the stable version of the sample data, sample data installation will work again without th Media.php file being present.

However, if you happen to be using a git repository clone as your Magento 2 installation (which is not recommended for project setups), and haven't checked out the proper version tag, you can still use the workaround by copying the file from the 2.0 branch, so you aren't forced to upgrade your installation just to get the sample data installed.

That did the trick, thanks @Vinai

@mudithae, thank you for your report.
This seems to be correct Magento behavior. Please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this.
Otherwise you may submit Pull Request with the suggested changes.

Was this page helpful?
0 / 5 - 0 ratings