I have a component with this model:
administrator/components/com_example/src/Model/FlowsModel.php
Code: Select all
namespace Acme\Component\Example\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel;
class FlowsModel extends ListModel
{
public function copyflows($ids)
{
return 'success';
}
}
administrator/components/com_example/src/Controller/FlowsController.php
Code: Select all
namespace Acme\Component\Example\Administrator\Controller;
use Joomla\CMS\MVC\Controller\AdminController;
class FlowsController extends AdminController
{
public function copyflows()
{
// Get the input
$pks = $this->input->post->get('cid', array(), 'array');
$pks = ArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Flows', 'Administrator');
// Check if the model exists and call the copyflows method
if ($model)
$msg = $model->copyflows($pks);
else
$msg = 'Model not found'; // <<<<< THIS MESSAGE IS DISPLAYED
Factory::getApplication()->enqueueMessage($msg, 'notice');
$this->setRedirect(Route::_('index.php?option=com_example&view=flows', false));
}
}
Any ideas very welcome