hey guys , I have extended user table in zed and add new column to table but it is not appearing .

U04TM8FELSF
U04TM8FELSF Posts: 34 πŸ§‘πŸ»β€πŸš€ - Cadet
edited June 2023 in Spryker Development

hey guys , I have extended user table in zed and add new column to table but it is not appearing . this is my userTable.php code and userCommunicationFactory.php code . Am I Missing something ?

Comments

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    In your UserCommunicationFactory, what namespace for your UsersTable is used?

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

    namespace Pyz\Zed\User\Communication;

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

    is there need to extend controller ? becaz inside controller they are calling facade and create the talble like this
    $usersTable = $this->getFactory()->createUserTable();

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    The facade get's resolved to your project facade, this should be fine.

    I would set a debugger breakpoint in the controller to see what is going on

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

    sir is there need to extend the controller ?

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    No, there is no need to extend the controller, extending the Table and the CommunicationFactory, as well as the *.schema.xml is enough.

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

    here i want to show mobile number as well . so is there need of schema file ?

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    As your SpyUsersTableMap already has a column COL_MOBILE_NUMBER you already extended the database via a schema file. That done.

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    As said:

    I would set a debugger breakpoint in the controller to see what is going on

    Without seeing the complete code it's pretty hard to find the issue. From looking at what you've shown it looks fine

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

    okay i will configure it and will check it .

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

    @U04TM8FELSF Can you may post all the use-statements of your CommunicationFactory?

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

    <?php

    /**
    * Copyright Β© 2016-present Spryker Systems GmbH. All rights reserved.
    * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
    */

    namespace Spryker\Zed\User\Communication;

    use Spryker\Zed\Kernel\Communication\AbstractCommunicationFactory;
    use Spryker\Zed\User\Communication\Form\ActivateUserForm;
    use Spryker\Zed\User\Communication\Form\DataProvider\UserFormDataProvider;
    use Spryker\Zed\User\Communication\Form\DataProvider\UserUpdateFormDataProvider;
    use Spryker\Zed\User\Communication\Form\DeactivateUserForm;
    use Spryker\Zed\User\Communication\Form\ResetPasswordForm;
    use Spryker\Zed\User\Communication\Form\UserDeleteConfirmForm;
    use Spryker\Zed\User\Communication\Form\UserForm;
    use Spryker\Zed\User\Communication\Form\UserUpdateForm;
    use Spryker\Zed\User\Communication\Table\PluginExecutor\UserTablePluginExecutor;
    use Spryker\Zed\User\Communication\Table\PluginExecutor\UserTablePluginExecutorInterface;
    use Spryker\Zed\User\Communication\Table\UsersTable;
    use Spryker\Zed\User\UserDependencyProvider;
    use Symfony\Component\Form\FormInterface;

    /**
    * @method \Spryker\Zed\User\Persistence\UserQueryContainerInterface getQueryContainer()
    * @method \Spryker\Zed\User\UserConfig getConfig()
    * @method \Spryker\Zed\User\Business\UserFacadeInterface getFacade()
    */
    class UserCommunicationFactory extends AbstractCommunicationFactory
    {
    /**
    * @return \Symfony\Component\Form\FormInterface
    */
    public function createResetPasswordForm()
    {
    return $this->getFormFactory()->create(ResetPasswordForm::class);
    }

    /**
     * @return \Spryker\Zed\User\Communication\Table\UsersTable
     */
    public function createUserTable()
    {
        return new UsersTable(
            $this->getQueryContainer(),
            $this->getProvidedDependency(UserDependencyProvider::SERVICE_DATE_FORMATTER),
            $this->createUserTablePluginExecutor(),
        );
    }
    
    /**
     * @return \Spryker\Zed\User\Communication\Table\PluginExecutor\UserTablePluginExecutorInterface
     */
    public function createUserTablePluginExecutor(): UserTablePluginExecutorInterface
    {
        return new UserTablePluginExecutor(
            $this->getUserTableActionExpanderPlugins(),
            $this->getUserTableConfigExpanderPlugins(),
            $this->getUserTableDataExpanderPlugins(),
        );
    }
    
    /**
     * @param array<string, mixed> $data
     * @param array<string, mixed> $options
     *
     * @return \Symfony\Component\Form\FormInterface
     */
    public function createUserForm(array $data = [], array $options = [])
    {
        return $this->getFormFactory()->create(UserForm::class, $data, $options);
    }
    
    /**
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserFormExpanderPluginInterface>
     */
    public function getFormExpanderPlugins(): array
    {
        return $this->getProvidedDependency(UserDependencyProvider::PLUGINS_USER_FORM_EXPANDER);
    }
    
    /**
     * @param array<string, mixed> $data
     * @param array<string, mixed> $options
     *
     * @return \Symfony\Component\Form\FormInterface
     */
    public function createUpdateUserForm(array $data = [], array $options = [])
    {
        return $this->getFormFactory()->create(UserUpdateForm::class, $data, $options);
    }
    
    /**
     * @return \Symfony\Component\Form\FormInterface
     */
    public function getUserDeleteConfirmForm(): FormInterface
    {
        return $this->getFormFactory()->create(UserDeleteConfirmForm::class);
    }
    
    /**
     * @return \Symfony\Component\Form\FormInterface
     */
    public function createActivateUserForm(): FormInterface
    {
        return $this->getFormFactory()->create(ActivateUserForm::class);
    }
    
    /**
     * @return \Symfony\Component\Form\FormInterface
     */
    public function createDeactivateUserForm(): FormInterface
    {
        return $this->getFormFactory()->create(DeactivateUserForm::class);
    }
    
    /**
     * @return \Spryker\Zed\User\Communication\Form\DataProvider\UserFormDataProvider
     */
    public function createUserFormDataProvider()
    {
        /** @var \Spryker\Zed\User\Business\UserFacade $userFacade */
        $userFacade = $this->getFacade();
    
        return new UserFormDataProvider($this->getGroupPlugin(), $userFacade);
    }
    
    /**
     * @return \Spryker\Zed\User\Communication\Form\DataProvider\UserUpdateFormDataProvider
     */
    public function createUserUpdateFormDataProvider()
    {
        /** @var \Spryker\Zed\User\Business\UserFacade $userFacade */
        $userFacade = $this->getFacade();
    
        return new UserUpdateFormDataProvider($this->getGroupPlugin(), $userFacade);
    }
    
    /**
     * @return \Spryker\Zed\User\Dependency\Plugin\GroupPluginInterface
     */
    public function getGroupPlugin()
    {
        return $this->getProvidedDependency(UserDependencyProvider::PLUGIN_GROUP);
    }
    
    /**
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableActionExpanderPluginInterface>
     */
    protected function getUserTableActionExpanderPlugins(): array
    {
        return $this->getProvidedDependency(UserDependencyProvider::PLUGINS_USER_TABLE_ACTION_EXPANDER);
    }
    
    /**
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableConfigExpanderPluginInterface>
     */
    protected function getUserTableConfigExpanderPlugins(): array
    {
        return $this->getProvidedDependency(UserDependencyProvider::PLUGINS_USER_TABLE_CONFIG_EXPANDER);
    }
    
    /**
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableDataExpanderPluginInterface>
     */
    protected function getUserTableDataExpanderPlugins(): array
    {
        return $this->getProvidedDependency(UserDependencyProvider::PLUGINS_USER_TABLE_DATA_EXPANDER);
    }
    

    }

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    use Spryker\Zed\User\Communication\Table\UsersTable; must be use Pyz\Zed\User\Communication\Table\UsersTable;

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    That was one of the first thing's I asked

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

    okay sir mobile number is appearing

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

    thank you sir