Mautic Community Forums

How to save custom plugin form data into database?

Hi

i have created new custom plugin and that plugin successfully created its displaying form with "First name & Last name " Now i wanted to save that form data(First & last name) into database.

Here is my plugin https://github.com/vishal-px/Mautic-Simple-Plugin



Now in this plugin i have created ENTITY FOLDER with files World.php & Worldrepository.php.

After adding this two file i getting this below errors.


> mautic log file error

[2017-08-14 05:54:32] mautic.WARNING: PHP Warning - require(/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php): failed to open stream: No such file or directory - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []

[2017-08-14 05:54:32] mautic.ERROR: PHP Notice: require(): Failed opening required '/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php' (include_path='.:/usr/share/php') - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []

[2017-08-14 05:54:32] mautic.ERROR: SymfonyComponentDebugExceptionFatalErrorException: Notice: require(): Failed opening required '/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php' (include_path='.:/usr/share/php') - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []


> And in Server log error file

[Mon Aug 14 11:24:41.603879 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning: Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginInstall(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginInstall(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, $installedSchema = NULL) in /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php on line 0, referer: http://localhost/10_08_17_mautic/s/update/schema

[Mon Aug 14 11:24:41.604147 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning - Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginUpdate(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL, MauticPlugin\HelloWorldBundle\Schema $installedSchema = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginUpdate(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, Doctrine\DBAL\Schema\Schema $installedSchema = NULL) - in file /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php - at line 0, referer: http://localhost/10_08_17_mautic/s/update/schema

[Mon Aug 14 11:24:41.604269 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning: Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginUpdate(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL, MauticPlugin\HelloWorldBundle\Schema $installedSchema = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginUpdate(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, Doctrine\DBAL\Schema\Schema $installedSchema = NULL) in /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php on line 0, referer: http://localhost/10_08_17_mautic/s/update/schema

Hi
i have created new custom plugin and that plugin successfully created its displaying form with "First name & Last name " Now i wanted to save that form data(First & last name) into database.
Here is my plugin https://github.com/vishal-px/Mautic-Simple-Plugin

Now in this plugin i have created ENTITY FOLDER with files World.php & Worldrepository.php.
After adding this two file i getting this below errors.

---------------> mautic log file error

[2017-08-14 05:54:32] mautic.WARNING: PHP Warning - require(/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php): failed to open stream: No such file or directory - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []

[2017-08-14 05:54:32] mautic.ERROR: PHP Notice: require(): Failed opening required ‘/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php’ (include_path=’.:/usr/share/php’) - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []

[2017-08-14 05:54:32] mautic.ERROR: SymfonyComponentDebugExceptionFatalErrorException: Notice: require(): Failed opening required ‘/var/www/html/10_08_17_mautic/app/cache/prod/doctrine/orm/Proxies/__CG__MauticPluginBundleEntityPlugin.php’ (include_path=’.:/usr/share/php’) - in file /var/www/html/10_08_17_mautic/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php - at line 209 [] []

------------> And in Server log error file

[Mon Aug 14 11:24:41.603879 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning: Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginInstall(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginInstall(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, $installedSchema = NULL) in /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php on line 0, referer: http://localhost/10_08_17_mautic/s/update/schema

[Mon Aug 14 11:24:41.604147 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning - Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginUpdate(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL, MauticPlugin\HelloWorldBundle\Schema $installedSchema = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginUpdate(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, Doctrine\DBAL\Schema\Schema $installedSchema = NULL) - in file /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php - at line 0, referer: http://localhost/10_08_17_mautic/s/update/schema

[Mon Aug 14 11:24:41.604269 2017] [:error] [pid 8127] [client 127.0.0.1:39906] PHP Warning: Declaration of MauticPlugin\HelloWorldBundle\HelloWorldBundle::onPluginUpdate(MauticPlugin\HelloWorldBundle\Plugin $plugin, MauticPlugin\HelloWorldBundle\MauticFactory $factory, $metadata = NULL, MauticPlugin\HelloWorldBundle\Schema $installedSchema = NULL) should be compatible with Mautic\PluginBundle\Bundle\PluginBundleBase::onPluginUpdate(Mautic\PluginBundle\Entity\Plugin $plugin, Mautic\CoreBundle\Factory\MauticFactory $factory, $metadata = NULL, Doctrine\DBAL\Schema\Schema $installedSchema = NULL) in /var/www/html/10_08_17_mautic/plugins/HelloWorldBundle/HelloWorldBundle.php on line 0, referer: http://localhost/10_08_17_mautic/s/update/schema