trying to create a new model class to be used as a source model for the admin configuration setting of a new module, I got the following message:
Class Makke\GroupOrders\Model\Config\Source\Sort does not exist
#0 C:\Projects\Marketplace\wamp\www\magento\vendor\magento\framework\Code\Reader\ClassReader.php(19): ReflectionClass->__construct('Makke\GroupOrde...')
#1 C:\Projects\Marketplace\wamp\www\magento\vendor\magento\framework\ObjectManager\Definition\Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Makke\GroupOrde...')
#2 C:\Projects\Marketplace\wamp\www\magento\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Makke\GroupOrde...')
Could you please help me in understanding what's wrong considering the following files?
in my ..\wamp\www\magento\app\code\makke\module-group-orders\etc\adminhtml\system.xml
there is the following field:
<field id="sort_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort by</label>
<source_model>Makke\GroupOrders\Model\Config\Source\Sort</source_model>
</field>
and my ..\wamp\www\magento\app\code\makke\module-group-orders\Model\Config\Source\Sort.php
is as follow:
/** * Used in creating options for Sort config value selection */ namespace Makke\GroupOrders\Model\Config\Source; class Sort implements \Magento\Framework\Option\ArrayInterface { /** * Options getter * * @return array */ public function toOptionArray() { return [['value' => 'asc_by_km', 'label' => __('ASC by km')], ['value' => 'desc_by_km', 'label' => __('DESC by km')], ['value' => 'asc_by_popularity', 'label' => __('ASC by popularity')], ['value' => 'desc_by_popularity', 'label' => __('DESC by popularity')]]; } /** * Get options in "key-value" format * * @return array */ public function toArray() { return ['asc_by_km' => __('ASC by km'), 'desc_by_km' => __('DESC by km'), 'asc_by_popularity' => __('ASC by popularity'), 'desc_by_popularity' => __('DESC by popularity')]; } }