ম্যাজেন্টো 2 তে গ্রাহক মডিউলের মতো কর্মচারী মডিউল তৈরি করুন


15

আমি কর্মচারী মডিউল তৈরি করেছি। গ্রাহক মডিউল হিসাবে একই। আমি থেকে সব ফাইল কপি করা vendor/magento/module-customerথেকে app/code/Magento/Employee। আমি গ্রাহককে কর্মচারীর সাথে প্রতিস্থাপন করেছি । তবে এটি একটি ত্রুটি দেখায়:

'অবৈধ অর্গমেন্ট এক্সেক্সেশন' বার্তা সহ 'কনস্ট্যান্ট নাম প্রত্যাশিত।

এবং

[অবৈধআর্গুমেন্টএক্সেপশন]
"সেটআপ" নেমস্পেসে কোনও আদেশ নির্দেশিত নেই।

আমার module.xmlরয়েছে app/Code/Magento/Employee/etcফোল্ডারের

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Employee" setup_version="2.0.6">
    <sequence>
        <module name="Magento_Eav"/>
        <module name="Magento_Directory"/>
    </sequence>
</module>
</config>

দয়া করে কেউ আমাকে বলুন আমি কীভাবে এটি সমাধান করব?

আমার di.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Employee\Api\AddressRepositoryInterface"
                type="Magento\Employee\Model\ResourceModel\AddressRepository" />
    <preference for="Magento\Employee\Api\EmployeeRepositoryInterface"
                type="Magento\Employee\Model\ResourceModel\EmployeeRepository" />
    <preference for="Magento\Employee\Api\GroupManagementInterface"
                type="Magento\Employee\Model\GroupManagement" />
    <preference for="Magento\Employee\Api\GroupRepositoryInterface"
                type="Magento\Employee\Model\ResourceModel\GroupRepository" />
    <preference for="Magento\Employee\Api\Data\EmployeeInterface" type="Magento\Employee\Model\Data\Employee" />
    <preference for="Magento\Employee\Api\Data\AddressInterface" type="Magento\Employee\Model\Data\Address" />
    <preference for="Magento\Employee\Api\Data\RegionInterface" type="Magento\Employee\Model\Data\Region" />
    <preference for="Magento\Employee\Api\Data\AttributeMetadataInterface"
                type="Magento\Employee\Model\Data\AttributeMetadata" />
    <preference for="Magento\Employee\Api\Data\GroupInterface" type="Magento\Employee\Model\Data\Group" />
    <preference for="Magento\Employee\Api\Data\OptionInterface" type="Magento\Employee\Model\Data\Option" />
    <preference for="Magento\Employee\Api\Data\ValidationRuleInterface"
                type="Magento\Employee\Model\Data\ValidationRule" />
    <preference for="Magento\Employee\Api\Data\ValidationResultsInterface"
                type="Magento\Employee\Model\Data\ValidationResults" />
    <preference for="Magento\Employee\Api\Data\GroupSearchResultsInterface"
                type="Magento\Framework\Api\SearchResults" />
    <preference for="Magento\Employee\Api\Data\EmployeeSearchResultsInterface"
                type="Magento\Framework\Api\SearchResults" />
    <preference for="Magento\Employee\Api\Data\AddressSearchResultsInterface"
                type="Magento\Framework\Api\SearchResults" />
    <preference for="Magento\Employee\Api\AccountManagementInterface"
                type="Magento\Employee\Model\AccountManagement" />
    <preference for="Magento\Employee\Api\EmployeeMetadataInterface"
                type="Magento\Employee\Model\Metadata\EmployeeCachedMetadata" />
    <preference for="Magento\Employee\Api\AddressMetadataInterface"
                type="Magento\Employee\Model\Metadata\AddressCachedMetadata" />
    <preference for="Magento\Employee\Api\EmployeeMetadataManagementInterface"
                type="Magento\Employee\Model\Metadata\EmployeeMetadataManagement" />
    <preference for="Magento\Employee\Api\AddressMetadataManagementInterface"
                type="Magento\Employee\Model\Metadata\AddressMetadataManagement" />
    <preference for="Magento\Employee\Api\EmployeeManagementInterface"
                type="Magento\Employee\Model\EmployeeManagement" />
    <type name="Magento\Employee\Model\EmployeeSession">
    <arguments>
        <argument name="configShare" xsi:type="object">Magento\Employee\Model\Config\Share\Proxy</argument>
        <argument name="employeeUrl" xsi:type="object">Magento\Employee\Model\Url\Proxy</argument>
        <argument name="employeeResource" xsi:type="object">Magento\Employee\Model\ResourceModel\Employee\Proxy</argument>
        <argument name="storage" xsi:type="object">Magento\Employee\Model\Session\Storage</argument>
        <argument name="employeeRepository" xsi:type="object">Magento\Employee\Api\EmployeeRepositoryInterface\Proxy</argument>
    </arguments>
</type>
    <type name="Magento\Employee\Helper\Address">
        <arguments>
            <argument name="addressConfig" xsi:type="object">Magento\Employee\Model\Address\Config\Proxy</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\Config\Share">
        <arguments>
            <argument name="employeeResource" xsi:type="object">Magento\Employee\Model\ResourceModel\Employee\Proxy</argument>
        </arguments>
    </type>
    <type name="Magento\Eav\Model\Entity\Setup\PropertyMapper\Composite">
        <arguments>
            <argument name="propertyMappers" xsi:type="array">
                <item name="employee" xsi:type="string">Magento\Employee\Model\ResourceModel\Setup\PropertyMapper</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Framework\Model\ActionValidator\RemoveAction">
        <arguments>
            <argument name="protectedModels" xsi:type="array">
                <item name="employee" xsi:type="string">Magento\Employee\Model\Employee</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\ResourceModel\Address">
        <arguments>
            <argument name="employeeRepository" xsi:type="object">Magento\Employee\Api\EmployeeRepositoryInterface\Proxy</argument>
            <argument name="entitySnapshot" xsi:type="object">EavVersionControlSnapshot</argument>
            <argument name="entityRelationComposite" xsi:type="object">EmployeeAddressRelationsComposite</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\Address\Config">
        <arguments>
            <argument name="reader" xsi:type="object">Magento\Employee\Model\Address\Config\Reader\Proxy</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\Visitor">
        <arguments>
            <argument name="ignoredUserAgents" xsi:type="array">
                <item name="google1" xsi:type="string">Googlebot/1.0 (googlebot@googlebot.com http://googlebot.com/)</item>
                <item name="google2" xsi:type="string">Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</item>
                <item name="google3" xsi:type="string">Googlebot/2.1 (+http://www.googlebot.com/bot.html)</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\ResourceModel\Group" shared="false">
        <arguments>
            <argument name="groupManagement" xsi:type="object">Magento\Employee\Api\GroupManagementInterface\Proxy</argument>
        </arguments>
    </type>
    <virtualType name="SectionInvalidationConfigReader" type="Magento\Framework\Config\Reader\Filesystem">
        <arguments>
            <argument name="idAttributes" xsi:type="array">
                <item name="/config/action" xsi:type="string">name</item>
                <item name="/config/action/section" xsi:type="string">name</item>
            </argument>
            <argument name="fileName" xsi:type="string">sections.xml</argument>
            <argument name="converter" xsi:type="object">\Magento\Employee\EmployeeData\SectionConfigConverter</argument>
            <argument name="schemaLocator" xsi:type="object">Magento\Employee\EmployeeData\SchemaLocator</argument>
            <argument name="defaultScope" xsi:type="string">frontend</argument>
        </arguments>
    </virtualType>
    <virtualType name="SectionInvalidationConfigData" type="Magento\Framework\Config\Data">
        <arguments>
            <argument name="reader" xsi:type="object">SectionInvalidationConfigReader</argument>
            <argument name="cacheId" xsi:type="string">sections_invalidation_config</argument>
        </arguments>
    </virtualType>
    <type name="Magento\Employee\Block\SectionConfig">
        <arguments>
            <argument name="sectionConfig" xsi:type="object">SectionInvalidationConfigData</argument>
        </arguments>
    </type>
    <type name="Magento\Eav\Model\EavCustomAttributeTypeLocator">
        <arguments>
            <argument name="serviceEntityTypeMap" xsi:type="array">
                <item name="Magento\Employee\Api\Data\EmployeeInterface" xsi:type="const">Magento\Employee\Api\EmployeeMetadataInterface::ENTITY_TYPE_Employee</item>
            </argument>
            <argument name="serviceBackendModelDataInterfaceMap" xsi:type="array">
                <item name="Magento\Employee\Api\Data\EmployeeInterface" xsi:type="array">
                    <item name="Magento\Eav\Model\Attribute\Data\Image" xsi:type="string">Magento\Framework\Api\Data\ImageContentInterface</item>
                </item>
            </argument>
        </arguments>
    </type>
    <virtualType name="EavVersionControlSnapshot" type="Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot">
        <arguments>
            <argument name="metadata" xsi:type="object">Magento\Eav\Model\Entity\VersionControl\Metadata</argument>
        </arguments>
    </virtualType>
    <virtualType name="EmployeeRelationsComposite" type="Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite">
        <arguments>
            <argument name="relationProcessors" xsi:type="array">
                <item name="default" xsi:type="object">Magento\Employee\Model\ResourceModel\Employee\Relation</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="EmployeeAddressRelationsComposite" type="Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite">
        <arguments>
            <argument name="relationProcessors" xsi:type="array">
                <item name="default" xsi:type="object">Magento\Employee\Model\ResourceModel\Address\Relation</item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Magento\Employee\Model\ResourceModel\Employee">
        <arguments>
            <argument name="entitySnapshot" xsi:type="object">EavVersionControlSnapshot</argument>
            <argument name="entityRelationComposite" xsi:type="object">EmployeeRelationsComposite</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\ResourceModel\Employee\Collection">
        <arguments>
            <argument name="entitySnapshot" xsi:type="object">EavVersionControlSnapshot</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\ResourceModel\Address\Collection">
        <arguments>
            <argument name="entitySnapshot" xsi:type="object">EavVersionControlSnapshot</argument>
        </arguments>
    </type>
    <virtualType name="Magento\Employee\Model\ResourceModel\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
        <arguments>
            <argument name="mainTable" xsi:type="string">employee_grid_flat</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Employee\Model\ResourceModel\Employee</argument>
        </arguments>
    </virtualType>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="employee_listing_data_source" xsi:type="string">Magento\Employee\Model\ResourceModel\Grid\Collection</item>
                <item name="employee_online_grid_data_source" xsi:type="string">Magento\Employee\Model\ResourceModel\Online\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="EmployeeNameHandler" type="Magento\Framework\Indexer\Handler\ConcatHandler">
        <arguments>
            <argument name="concatExpression" xsi:type="object">EmployeeNameExpression</argument>
        </arguments>
    </virtualType>
    <virtualType name="ShippingAddressHandler" type="Magento\Framework\Indexer\Handler\ConcatHandler">
        <arguments>
            <argument name="concatExpression" xsi:type="object">ShippingAddressExpression</argument>
        </arguments>
    </virtualType>
    <virtualType name="BillingAddressHandler" type="Magento\Framework\Indexer\Handler\ConcatHandler">
        <arguments>
            <argument name="concatExpression" xsi:type="object">BillingAddressExpression</argument>
        </arguments>
    </virtualType>
    <virtualType name="LastVisitAtHandler" type="Magento\Framework\Indexer\Handler\ConcatHandler">
        <arguments>
            <argument name="concatExpression" xsi:type="object">LastVisitAtSubSelect</argument>
        </arguments>
    </virtualType>
    <virtualType name="LastVisitAtSubSelect" type="Magento\Framework\DB\Sql\LookupExpression">
        <arguments>
            <argument name="targetTable" xsi:type="string">employee_visitor</argument>
            <argument name="targetColumn" xsi:type="string">last_visit_at</argument>
            <argument name="referenceColumns" xsi:type="array">
                <item name="employee_id" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">entity_id</item>
                </item>
            </argument>
            <argument name="sortOrder" xsi:type="array">
                <item name="DESC" xsi:type="string">last_visit_at</item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="EmployeeNameExpression" type="Magento\Framework\DB\Sql\ConcatExpression">
        <arguments>
            <argument name="tableName" xsi:type="string">e</argument>
            <argument name="columns" xsi:type="array">
                <item name="prefix" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">prefix</item>
                </item>
                <item name="firstname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">firstname</item>
                </item>
                <item name="middlename" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">middlename</item>
                </item>
                <item name="lastname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">lastname</item>
                </item>
                <item name="suffix" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">e</item>
                    <item name="columnName" xsi:type="string">suffix</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="ShippingAddressExpression" type="Magento\Framework\DB\Sql\ConcatExpression">
        <arguments>
            <argument name="columns" xsi:type="array">
                <item name="prefix" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">shipping</item>
                    <item name="columnName" xsi:type="string">street</item>
                </item>
                <item name="firstname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">shipping</item>
                    <item name="columnName" xsi:type="string">city</item>
                </item>
                <item name="middlename" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">shipping</item>
                    <item name="columnName" xsi:type="string">region</item>
                </item>
                <item name="lastname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">shipping</item>
                    <item name="columnName" xsi:type="string">postcode</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <virtualType name="BillingAddressExpression" type="Magento\Framework\DB\Sql\ConcatExpression">
        <arguments>
            <argument name="columns" xsi:type="array">
                <item name="prefix" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">billing</item>
                    <item name="columnName" xsi:type="string">street</item>
                </item>
                <item name="firstname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">billing</item>
                    <item name="columnName" xsi:type="string">city</item>
                </item>
                <item name="middlename" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">billing</item>
                    <item name="columnName" xsi:type="string">region</item>
                </item>
                <item name="lastname" xsi:type="array">
                    <item name="tableAlias" xsi:type="string">billing</item>
                    <item name="columnName" xsi:type="string">postcode</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Magento\Employee\Model\Indexer\AttributeProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">Magento\Employee\Model\ResourceModel\Attribute\Collection</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\Indexer\Address\AttributeProvider">
        <arguments>
            <argument name="collection" xsi:type="object" shared="false">Magento\Employee\Model\ResourceModel\Address\Attribute\Collection</argument>
        </arguments>
    </type>
    <type name="Magento\Employee\Model\ResourceModel\Online\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">employee_visitor</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Employee\Model\ResourceModel\Visitor</argument>
        </arguments>
    </type>
</config>

উম ... হাঁ। এটি এত সহজ হবে না। আপনি ঠিক কি খুঁজে পেতে চেষ্টা করছেন? আপনার এটি কাস্টম ORM মডেল এবং মডিউল হিসাবে তৈরি করা উচিত।
রায়ান হোয়ের

আমি গ্রাহক মডিউল
মিঃ এর

উত্তর:


5

আমি মনে করি এটি স্থির di.xml:

Magento\Employee\Api\EmployeeMetadataInterface::ENTITY_TYPE_Employee

হতে হবে

Magento\Employee\Api\EmployeeMetadataInterface::ENTITY_TYPE_EMPLOYEE

3

mr.max,

আপনার জন্য একটি সমাধান এখানে:

  1. যদি আপনি ছোট হাতের অক্ষর এবং বড় হাতের অক্ষরে ফাইলগুলি প্রতিস্থাপন করেন ("গ্রাহক" -> "কর্মচারী", "গ্রাহক" -> "কর্মচারী" ইত্যাদি)
  2. যদি আপনি ফাইলের নাম এবং ফোল্ডারের নাম পরিবর্তন করে থাকেন তবে সেখানে "গ্রাহক" শব্দ রয়েছে কিনা তা পরীক্ষা করে দেখুন।
  3. নিশ্চিত হয়ে নিন যে আপনি অন্য কোনও শব্দ "গ্রাহক" পরিবর্তন করেন নি। উদাহরণস্বরূপ, ফাইলটিতে

    vendor/magento/module-customer/Controller/Adminhtml/Index/MassSubscribe.php

    একটি কোড আছে

    $this->subscriberFactory->create()->subscribeCustomerById($customerId);

    তার মানে হল যে পদ্ধতিটি subscribeCustomerById"মডিউল-নিউজলেটার" মডিউল ( Magento\Newsletter\Model\Subscriber) থেকে ডাকা হয় । এবং আপনি যদি এর নামটি পরিবর্তন করেন তবে আপনি subscribeEmployeeByIdত্রুটি পাবেন।

আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.