What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello all, I am getting this error: `You need to implement `Spryker\Zed\Gui\Communication\Table\Abs

Options
U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

Hello all,

I am getting this error:
You need to implementSpryker\Zed\Gui\Communication\Table\AbstractTable::getCsvHeaders()in yourSpryker\Zed\Glossary\Communication\Table\TranslationTable.

Even though I have implemented this function inside Spryker\Zed\Glossary\Communication\Table\TranslationTable

Can some one please advise?

Comments

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    Hey, this sounds a bit strange: Spryker\Zed\Glossary\Communication\Table\TranslationTable should not be touched by you since it should be in the vendor-folder. What do you mean by “you have implemented this function” ?

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz I have extended this class inside my own directory like this:

    <?php
    
    namespace Playground\Zed\Glossary\Communication\Table;
    
    use Spryker\Zed\Glossary\Communication\Table\TranslationTable as SprykerTranslationTable;
    
    class TranslationTable extends SprykerTranslationTable
    {
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_ID = 'spy_glossary_key.id_glossary_key';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_KEY = 'spy_glossary_key.key';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_EN_US = 'en_US';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_DE_DE = 'de_DE';
    
        /**
         * @return array<string>
         */
        protected function getCsvHeaders(): array
        {
            return [
                static::COL_GLOSSARY_ID => '#',
                static::COL_GLOSSARY_KEY => 'Name',
                static::COL_GLOSSARY_EN_US => 'EN_US',
                static::COL_GLOSSARY_DE_DE => 'DE_DE',
    
            ];
        }
    }
    
  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    ahh ok, so it seems that your changed file is not loaded properly. Have you adjusted the right factory (in this case GlossaryCommunicationFactory) as you need to do for most of the files you extend on project level?

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz No I haven't adjusted the factory. So I also need to extend the factory in the same directory?

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    yes, actually this is pretty standard if you extend stuff on project level, one of crucial information you need to learn if you code in Spryker 🙂 But i guess now you will memorize for next time 💪

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz thank you for your help 🙂

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options
  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz So I am still getting the same error. Here is my directory structure and the code files. And I did add the project configurations in composer and config_default

    <?php
    
    namespace Playground\Zed\Glossary\Communication\Table;
    
    use Spryker\Zed\Glossary\Communication\Table\TranslationTable as SprykerTranslationTable;
    
    class TranslationTable extends SprykerTranslationTable
    {
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_ID = 'spy_glossary_key.id_glossary_key';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_KEY = 'spy_glossary_key.key';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_EN_US = 'en_US';
    
        /**
         * @var string
         */
        public const COL_GLOSSARY_DE_DE = 'de_DE';
    
        /**
         * @return array<string>
         */
        protected function getCsvHeaders(): array
        {
            return [
                static::COL_GLOSSARY_ID => '#',
                static::COL_GLOSSARY_KEY => 'Name',
                static::COL_GLOSSARY_EN_US => 'EN_US',
                static::COL_GLOSSARY_DE_DE => 'DE_DE',
    
            ];
        }
    }
    
    <?php
    
    namespace Playground\Zed\Glossary\Communication;
    
    use Spryker\Zed\Glossary\Communication\GlossaryCommunicationFactory as SprykerGlossaryCommunicationFactory;
    use Playground\Zed\Glossary\Communication\Table\TranslationTable;
    
    class GlossaryCommunicationFactory extends SprykerGlossaryCommunicationFactory
    {
    
        /**
         * @param array $locales
         *
         * @return \Spryker\Zed\Glossary\Communication\Table\TranslationTable
         */
        public function createTranslationTable(array $locales)
        {
            $glossaryKeyQuery = $this->getQueryContainer()
                ->queryKeys();
    
            $subQuery = $this->getQueryContainer()
                ->queryTranslations();
    
            return new TranslationTable($glossaryKeyQuery, $subQuery, $locales);
        }
    }
    
  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    Did any other file in your namespace “Playground” work so far? My guess is no

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz, yes the Twig file in the Presentation folder is replacing the twig file in the vendor folder successfully

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz It works now. There was some browser caching issue which was calling the old URL

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    ahh ok, so wrong guess of me 😛 Then you have already added that namespace to the config 💪 nice

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    glad it works now

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @florian.scholz thanks again

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    if you override or remove Spryker autoloaded files (see files listed here https://docs.spryker.com/docs/scos/dev/architecture/code-buckets.html#logical-inheritance) you normally have to call the console class-resolver:build command