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

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,051 โš–๏ธ - 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โ€ ?

  • U048WDEP3R7
    U048WDEP3R7 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',
    
            ];
        }
    }
    
  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 โš–๏ธ - 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?

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @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,051 โš–๏ธ - 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 ๐Ÿ’ช

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

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

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 โš–๏ธ - Guardians (admin)
  • U048WDEP3R7
    U048WDEP3R7 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);
        }
    }
    
  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 โš–๏ธ - Guardians (admin)

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

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @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

    @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,051 โš–๏ธ - Guardians (admin)

    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,051 โš–๏ธ - Guardians (admin)

    glad it works now

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    @florian.scholz thanks again

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 โš–๏ธ - 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