Magento 2.2.5 : Cant go to execute() in Controller
I'm doing a simple CRUD custom module after this module
C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoFrameworkRegistry;
use MagentoFrameworkViewResultPageFactory;
use MagentoBackendAppActionContext;
use FuduHelloWorldModelStudentsFactory;
use FuduHelloWorldModelResourceModelStudents as ResourceModel;
class Create extends MagentoBackendAppAction
{
/**
* @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 MagentoFrameworkControllerResultInterface
*/
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
//
if ($data) {
try{
/** @var FuduHelloWorldModelStudents $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:xampphtdocsmagentovarlogsystem.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
magento2 magento2.2 controllers crud construct
|
show 7 more comments
I'm doing a simple CRUD custom module after this module
C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoFrameworkRegistry;
use MagentoFrameworkViewResultPageFactory;
use MagentoBackendAppActionContext;
use FuduHelloWorldModelStudentsFactory;
use FuduHelloWorldModelResourceModelStudents as ResourceModel;
class Create extends MagentoBackendAppAction
{
/**
* @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 MagentoFrameworkControllerResultInterface
*/
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
//
if ($data) {
try{
/** @var FuduHelloWorldModelStudents $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:xampphtdocsmagentovarlogsystem.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
magento2 magento2.2 controllers crud construct
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code theexecute
method is magento own custom method that's why it is not calling and__construct
is magic method it will default calling while call PHP file.
– kunj
Jul 19 '18 at 13:37
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40
|
show 7 more comments
I'm doing a simple CRUD custom module after this module
C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoFrameworkRegistry;
use MagentoFrameworkViewResultPageFactory;
use MagentoBackendAppActionContext;
use FuduHelloWorldModelStudentsFactory;
use FuduHelloWorldModelResourceModelStudents as ResourceModel;
class Create extends MagentoBackendAppAction
{
/**
* @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 MagentoFrameworkControllerResultInterface
*/
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
//
if ($data) {
try{
/** @var FuduHelloWorldModelStudents $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:xampphtdocsmagentovarlogsystem.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
magento2 magento2.2 controllers crud construct
I'm doing a simple CRUD custom module after this module
C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoFrameworkRegistry;
use MagentoFrameworkViewResultPageFactory;
use MagentoBackendAppActionContext;
use FuduHelloWorldModelStudentsFactory;
use FuduHelloWorldModelResourceModelStudents as ResourceModel;
class Create extends MagentoBackendAppAction
{
/**
* @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 MagentoFrameworkControllerResultInterface
*/
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
//
if ($data) {
try{
/** @var FuduHelloWorldModelStudents $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:xampphtdocsmagentovarlogsystem.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
magento2 magento2.2 controllers crud construct
magento2 magento2.2 controllers crud construct
edited 20 mins ago
Teja Bhagavan Kollepara
2,94841847
2,94841847
asked Jul 19 '18 at 13:26
fudufudu
37411
37411
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code theexecute
method is magento own custom method that's why it is not calling and__construct
is magic method it will default calling while call PHP file.
– kunj
Jul 19 '18 at 13:37
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40
|
show 7 more comments
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code theexecute
method is magento own custom method that's why it is not calling and__construct
is magic method it will default calling while call PHP file.
– kunj
Jul 19 '18 at 13:37
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code the
execute
method is magento own custom method that's why it is not calling and __construct
is magic method it will default calling while call PHP file.– kunj
Jul 19 '18 at 13:37
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code the
execute
method is magento own custom method that's why it is not calling and __construct
is magic method it will default calling while call PHP file.– kunj
Jul 19 '18 at 13:37
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40
|
show 7 more comments
3 Answers
3
active
oldest
votes
Make your controller extend MagentoFrameworkAppActionAction
instead of MagentoBackendAppAction
, that should solve your issue.
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
|
show 3 more comments
You can't grant permission for new admin user on this controller, because when you extend MagentoFrameworkAppActionAction that mean by passing Magento Access Control list.
Please re-check these issues:
acl.xml file- make sure your you have _isAllowed function in your controller and return _authorization->isAllowed with resource id in acl.xml file.
- Try to Log out and re-login admin user.
Ex Admin Controller.
Class [Action Name] extends MagentoBackendAppAction
{
/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('[resource id in **acl.xml**]');
}
}
add a comment |
Try this code :
<?php
namespace FuduHelloWorldControllerAdminhtmlStudent;
class Create extends MagentoBackendAppAction
{
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
echo "controller call successfully";
exit;
}
}
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235166%2fmagento-2-2-5-cant-go-to-execute-in-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Make your controller extend MagentoFrameworkAppActionAction
instead of MagentoBackendAppAction
, that should solve your issue.
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
|
show 3 more comments
Make your controller extend MagentoFrameworkAppActionAction
instead of MagentoBackendAppAction
, that should solve your issue.
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
|
show 3 more comments
Make your controller extend MagentoFrameworkAppActionAction
instead of MagentoBackendAppAction
, that should solve your issue.
Make your controller extend MagentoFrameworkAppActionAction
instead of MagentoBackendAppAction
, that should solve your issue.
answered Jul 20 '18 at 0:52
Vivek KumarVivek Kumar
2,4372629
2,4372629
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
|
show 3 more comments
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
thanks alot, you r the boss , Kick . +1 vote for you my bro
– fudu
Jul 20 '18 at 1:24
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
but can u explain why ? i'm follow the module-cms in magento project, i do the same as they do, but doesn't work. in C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php, they extends MagentoBackendAppAction, but i cant? why ?
– fudu
Jul 20 '18 at 1:28
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Tbh , I don't know the exact reason myself, it happened to me once and same thing solved my problem . I guess it was because I was not rendering any backend page, the controller was just for saving data to db which caused the redirection.
– Vivek Kumar
Jul 20 '18 at 2:03
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
Please do upvote the post if you want, I will look further into this when I get time... don't get much time from development to see what was causing the issue once it gets fixed. :p
– Vivek Kumar
Jul 20 '18 at 2:04
1
1
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
You can't grand permission for new Admin User on this controller, because when you extend MagentoFrameworkAppActionAction that mean by pass Magento Access Control list.
– HoangHieu
Jul 23 '18 at 4:39
|
show 3 more comments
You can't grant permission for new admin user on this controller, because when you extend MagentoFrameworkAppActionAction that mean by passing Magento Access Control list.
Please re-check these issues:
acl.xml file- make sure your you have _isAllowed function in your controller and return _authorization->isAllowed with resource id in acl.xml file.
- Try to Log out and re-login admin user.
Ex Admin Controller.
Class [Action Name] extends MagentoBackendAppAction
{
/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('[resource id in **acl.xml**]');
}
}
add a comment |
You can't grant permission for new admin user on this controller, because when you extend MagentoFrameworkAppActionAction that mean by passing Magento Access Control list.
Please re-check these issues:
acl.xml file- make sure your you have _isAllowed function in your controller and return _authorization->isAllowed with resource id in acl.xml file.
- Try to Log out and re-login admin user.
Ex Admin Controller.
Class [Action Name] extends MagentoBackendAppAction
{
/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('[resource id in **acl.xml**]');
}
}
add a comment |
You can't grant permission for new admin user on this controller, because when you extend MagentoFrameworkAppActionAction that mean by passing Magento Access Control list.
Please re-check these issues:
acl.xml file- make sure your you have _isAllowed function in your controller and return _authorization->isAllowed with resource id in acl.xml file.
- Try to Log out and re-login admin user.
Ex Admin Controller.
Class [Action Name] extends MagentoBackendAppAction
{
/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('[resource id in **acl.xml**]');
}
}
You can't grant permission for new admin user on this controller, because when you extend MagentoFrameworkAppActionAction that mean by passing Magento Access Control list.
Please re-check these issues:
acl.xml file- make sure your you have _isAllowed function in your controller and return _authorization->isAllowed with resource id in acl.xml file.
- Try to Log out and re-login admin user.
Ex Admin Controller.
Class [Action Name] extends MagentoBackendAppAction
{
/**
* {@inheritdoc}
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('[resource id in **acl.xml**]');
}
}
edited Jul 24 '18 at 0:28
Vivek Kumar
2,4372629
2,4372629
answered Jul 23 '18 at 4:43
HoangHieuHoangHieu
691514
691514
add a comment |
add a comment |
Try this code :
<?php
namespace FuduHelloWorldControllerAdminhtmlStudent;
class Create extends MagentoBackendAppAction
{
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
echo "controller call successfully";
exit;
}
}
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
add a comment |
Try this code :
<?php
namespace FuduHelloWorldControllerAdminhtmlStudent;
class Create extends MagentoBackendAppAction
{
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
echo "controller call successfully";
exit;
}
}
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
add a comment |
Try this code :
<?php
namespace FuduHelloWorldControllerAdminhtmlStudent;
class Create extends MagentoBackendAppAction
{
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
echo "controller call successfully";
exit;
}
}
Try this code :
<?php
namespace FuduHelloWorldControllerAdminhtmlStudent;
class Create extends MagentoBackendAppAction
{
public function __construct(
MagentoBackendAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
echo "controller call successfully";
exit;
}
}
answered Jul 19 '18 at 15:27
Rohan HapaniRohan Hapani
1
1
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
add a comment |
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
doesn't work, i clear cache and gerenation folder as well
– fudu
Jul 19 '18 at 15:43
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
Can you please upload system.log or exception.log here?
– Rohan Hapani
Jul 19 '18 at 15:48
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
system.log is updated on my post, please take a look
– fudu
Jul 19 '18 at 15:54
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235166%2fmagento-2-2-5-cant-go-to-execute-in-controller%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need API for this. Create custom api.
– kunj
Jul 19 '18 at 13:29
what do u mean i need API for this ? i'm follow the module-cms in magento core project in the link below ~~~~~~~~~~~~ C:xampphtdocsmagentovendormagentomodule-cmsControllerAdminhtmlPageSave.php ~~~~~~~~~~~~ can u make it clearer? thanks for reading my issue .
– fudu
Jul 19 '18 at 13:32
and i do almost same thing as they do in that Save.php, so i dont know what u mean when u say i need API
– fudu
Jul 19 '18 at 13:36
As you are calling admin side by CURL you need admin username and password second you can not call any controller without secure key. Magento have API feature to POST and GET data by CURL. I just review your updated code the
execute
method is magento own custom method that's why it is not calling and__construct
is magic method it will default calling while call PHP file.– kunj
Jul 19 '18 at 13:37
hmmm ... but how can i make API to CRUD now ?
– fudu
Jul 19 '18 at 13:40