I'm doing a simple CRUD custom module after this module
C:\xampp\htdocs\magento\vendor\magento\module-cms\Controller\Adminhtml\Page\Save.php
and I have a controller to save/create/add the "students" to database.
but something is missing here
so the controller only go to the __construct() function
but the execute() function doesn't work
You see, when I var_dump('111'); in the __construct() function, it works fine
but when I var_dump('111'); in the execute() function, nothing happened.
<br> Here is my controller: <br> <?php /** * Created by PhpStorm. * User: Administrator * Date: 18/07/2018 * Time: 1:30 CH */ namespace Fudu\HelloWorld\Controller\Adminhtml\Student; use Magento\Framework\Registry; use Magento\Framework\View\Result\PageFactory; use Magento\Backend\App\Action\Context; use Fudu\HelloWorld\Model\StudentsFactory; use Fudu\HelloWorld\Model\ResourceModel\Students as ResourceModel; class Create extends \Magento\Backend\App\Action { /** * @var StudentsFactory */ protected $studentsFactory; /** * @var ResourceModel */ protected $resourceModel; public function __construct( Context $context, Registry $coreRegistry, PageFactory $resultPageFactory, StudentsFactory $studentsFactory, ResourceModel $resourceModel ) { $this->resourceModel = $resourceModel; $this->studentsFactory = $studentsFactory; parent::__construct($context); } /** * Save action * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { $data = $this->getRequest()->getPostValue(); /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); // if ($data) { try{ /** @var \Fudu\HelloWorld\Model\Students $model */ $model = $this->studentsFactory->create(); $model->setData($data); $this->resourceModel->save($model); $this->messageManager->addSuccessMessage(__('Create Student Successfully.')); // Redirect to your form page (or anywhere you want...) $resultRedirect->setPath('/companymodule/index/booking'); return $resultRedirect; } catch (\Exception $e) { $this->messageManager->addErrorMessage($e->getMessage()); } } } } <br> system.log : <br> C:\xampp\htdocs\magento\var\log\system.log <br> [2018-07-19 15:44:29] main.INFO: Item Magento_Backend::system_currency was removed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_design_schedule was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_store was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::dashboard was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_tools was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_design was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_convert was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_cache was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::marketing was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::marketing_communications was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::marketing_seo was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::marketing_user_content was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::content was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::content_elements was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::stores was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::stores_settings was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::stores_attributes was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::other_settings was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::system_other_settings was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backend::setup_wizard was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Fudu_HelloWorld::main_menu was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Fudu_HelloWorld::add_students was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Fudu_HelloWorld::manage_students was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Fudu_HelloWorld::configuration was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Theme::design_config was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Theme::system_design_theme was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Customer::customer was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Customer::customer_manage was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Customer::customer_online was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Customer::customer_group was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_AdminNotification::system_adminnotification was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Indexer::system_index was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Config::system_config was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Cms::cms_page was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Cms::cms_block was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Backup::system_tools_backup was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::catalog was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::catalog_products was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::catalog_categories was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::catalog_attributes_attributes was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::catalog_attributes_sets was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Catalog::inventory was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Search::search_terms was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Search::search_synonyms was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_UrlRewrite::urlrewrite was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_operation was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_order was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_invoice was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_shipment was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_creditmemo was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::sales_transactions was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sales::system_order_statuses was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Widget::cms_widget_instance was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CheckoutAgreements::sales_checkoutagreement was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Downloadable::report_products_downloads was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_User::system_acl was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_User::system_acl_users was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_User::system_acl_roles was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_User::system_acl_locks was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Tax::sales_tax was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Tax::sales_tax_rules was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Tax::sales_tax_rates was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Email::template was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CurrencySymbol::system_currency was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CurrencySymbol::system_currency_rates was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CurrencySymbol::system_currency_symbols was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Paypal::report_salesroot_paypal_settlement_reports was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Paypal::paypal_billing_agreement was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Integration::system_extensions was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Integration::system_integrations was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Amazon_Core::logs was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Amazon_Core::client_logs was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Amazon_Core::ipn_logs was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CatalogRule::promo was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_CatalogRule::promo_catalog was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_ImportExport::system_convert_import was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_ImportExport::system_convert_export was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_ImportExport::system_convert_history was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Newsletter::newsletter_template was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Newsletter::newsletter_queue was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Newsletter::newsletter_subscriber was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Newsletter::newsletter_problem was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_EncryptionKey::system_crypt_key was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Braintree::settlement_report was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Analytics::business_intelligence was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Analytics::advanced_reporting was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Analytics::bi_essentials was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Marketplace::partners was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_SalesRule::promo_quote was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_marketing was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_sales was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_tax was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_invoiced was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_shipping was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_refunded was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_salesroot_coupons was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_shopcart_product was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_shopcart_abandoned was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_products was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_products_bestsellers was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_products_sold was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_products_viewed was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_products_lowstock was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_customers was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_customers_accounts was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_customers_totals was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_customers_orders was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_statistics was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Reports::report_statistics_refresh was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Search::report_search_term was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Review::catalog_reviews_ratings_ratings was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Review::catalog_reviews_ratings_reviews_all was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Review::report_review was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Review::report_review_customer was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Review::report_review_product was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Sitemap::catalog_sitemap was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_TaxImportExport::system_convert_tax was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Magento_Variable::system_variable was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::marketing_automation was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::automation_studio was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::exclusion_rules was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::marketing_automation_report was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::importer was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::automation was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::campaign was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::cron was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::dashboards was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::logviewer was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Dotdigitalgroup_Email::abandoned was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Shopial_Facebook::marketing_social was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Shopial_Facebook::shopial_facebook was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Temando_Shipping::shipping was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Temando_Shipping::carriers was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Temando_Shipping::locations was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Temando_Shipping::packaging was processed [] [] [2018-07-19 15:44:29] main.INFO: Add of item with id Temando_Shipping::dispatches was processed [] []
executemethod is magento own custom method that's why it is not calling and__constructis magic method it will default calling while call PHP file.