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

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?

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    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” ?

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

    @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',
    
            ];
        }
    }
    
  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    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?

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

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

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    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 πŸ’ͺ

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

    @florian.scholz thank you for your help πŸ™‚

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)
  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

    @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);
        }
    }
    
  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

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

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

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

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

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

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    ahh ok, so wrong guess of me πŸ˜› Then you have already added that namespace to the config πŸ’ͺ nice

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    glad it works now

  • Posts: 217 πŸ§‘πŸ»β€πŸš€ - Cadet

    @florian.scholz thanks again

  • Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,107 βš–οΈ - Guardians (admin)

    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

Welcome!

It looks like you're new here. Sign in or register to get started.