0

I have an Edit.php for backend, at first it was running fine and then after i run upgrade, i got this following error:

1 exception(s): Exception #0 (InvalidArgumentException): Boolean value is expected, supported values: array ( 0 => true, 1 => 1, 2 => 'true', 3 => '1', 4 => false, 5 => 0, 6 => 'false', 7 => '0', )

Exception #0 (InvalidArgumentException): Boolean value is expected, supported values: array ( 0 => true, 1 => 1, 2 => 'true', 3 => '1', 4 => false, 5 => 0, 6 => 'false', 7 => '0', )

#0 C:\xampp7\htdocs\magento2\vendor\magento\framework\Data\Argument\Interpreter\Boolean.php(40): Magento\Framework\Stdlib\BooleanUtils->toBoolean('required')

#1 C:\xampp7\htdocs\magento2\vendor\magento\framework\Data\Argument\Interpreter\Composite.php(61): Magento\Framework\Data\Argument\Interpreter\Boolean->evaluate(Array)

#2 C:\xampp7\htdocs\magento2\vendor\magento\framework\Data\Argument\Interpreter\ArrayType.php(43): Magento\Framework\Data\Argument\Interpreter\Composite->evaluate(Array)

#31 C:\xampp7\htdocs\magento2\app\code\Lime\Confirmation\Controller\Adminhtml\Bankdestination\Edit.php(53): Lime\Confirmation\Controller\Adminhtml\Bankdestination\Edit\Interceptor->initPage(Object(Magento\Backend\Model\View\Result\Page\Interceptor))

here's my code:

<?php


namespace Lime\Confirmation\Controller\Adminhtml\Bankdestination;

class Edit extends \Lime\Confirmation\Controller\Adminhtml\Bankdestination
{

    protected $resultPageFactory;

    /**
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Framework\Registry $coreRegistry
     * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\Registry $coreRegistry,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        parent::__construct($context, $coreRegistry);
    }

    /**
     * Edit action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */
    public function execute()
    {

        // 1. Get ID and create model
        $id = $this->getRequest()->getParam('bank_destination_id');
        $model = $this->_objectManager->create('Lime\Confirmation\Model\BankDestination');

        // 2. Initial checking
        if ($id) {
            $model->load($id);
            if (!$model->getId()) {
                $this->messageManager->addError(__('This Bank Destination no longer exists.'));
                /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
                $resultRedirect = $this->resultRedirectFactory->create();
                return $resultRedirect->setPath('*/*/');
            }
        }
        $this->_coreRegistry->register('lime_confirmation_bank_destination', $model);

        // 5. Build edit form
        /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
        $resultPage = $this->resultPageFactory->create();
        //the start of error
        $this->initPage($resultPage)->addBreadcrumb(
            $id ? __('Edit Bank Destination') : __('New Bank Destination'),
            $id ? __('Edit Bank Destination') : __('New Bank Destination')
        );

        $resultPage->getConfig()->getTitle()->prepend(__('Bank Destinations'));
        $resultPage->getConfig()->getTitle()->prepend($model->getId() ? $model->getTitle() : __('New Bank Destination'));
        return $resultPage;
    }
}

1 Answer 1

1

You can calling the method that not define in class $this->initPage either create the Method

replace

$this->initPage($resultPage)->addBreadcrumb(
            $id ? __('Edit Bank Destination') : __('New Bank Destination'),
            $id ? __('Edit Bank Destination') : __('New Bank Destination')
        );

with

$resultPage->addBreadcrumb(
            $id ? __('Edit Bank Destination') : __('New Bank Destination'),
            $id ? __('Edit Bank Destination') : __('New Bank Destination')
        );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.