2 deleted 20 characters in body
source | link

i'm doing update "students" on magento 2.2.5
and i'm stuck in how to get student data by id
the error say:

1 exception(s):
Exception #0 (InvalidArgumentException): Invalid return type

here is my code:

<?php

namespace Fudu\HelloWorld\Controller\Adminhtml\Student;

use Magento\Backend\App\Action;
use Fudu\HelloWorld\Model\StudentsFactory;
use \Magento\Framework\Exception\NoSuchEntityException;

class Update extends Action
{

/**
 * @var StudentsFactory
 */
protected $studentsFactory;

public function __construct(
    Action\Context $context,
    StudentsFactory $studentsFactory
)
{
    $this->studentsFactory = $studentsFactory;
    parent::__construct($context);
}

/**
 *  Load Student data by given Student Id
 *
 * @return $student
 * @throws NoSuchEntityException
 */

public function execute()
{

    $id = $this->getRequest()->getParam('id');
    $student = $this->studentsFactory->create();
    $student->load($id);

    return $student;
}
}

thanks for reading

i'm doing update "students" on magento 2.2.5
and i'm stuck in how to get student data by id
the error say:

1 exception(s):
Exception #0 (InvalidArgumentException): Invalid return type

here is my code:

<?php

namespace Fudu\HelloWorld\Controller\Adminhtml\Student;

use Magento\Backend\App\Action;
use Fudu\HelloWorld\Model\StudentsFactory;
use \Magento\Framework\Exception\NoSuchEntityException;

class Update extends Action
{

/**
 * @var StudentsFactory
 */
protected $studentsFactory;

public function __construct(
    Action\Context $context,
    StudentsFactory $studentsFactory
)
{
    $this->studentsFactory = $studentsFactory;
    parent::__construct($context);
}

/**
 *  Load Student data by given Student Id
 *
 * @return $student
 * @throws NoSuchEntityException
 */

public function execute()
{

    $id = $this->getRequest()->getParam('id');
    $student = $this->studentsFactory->create();
    $student->load($id);

    return $student;
}
}

thanks for reading

i'm doing update "students" on magento 2.2.5
and i'm stuck in how to get student data by id
the error say:

1 exception(s):
Exception #0 (InvalidArgumentException): Invalid return type

here is my code:

<?php

namespace Fudu\HelloWorld\Controller\Adminhtml\Student;

use Magento\Backend\App\Action;
use Fudu\HelloWorld\Model\StudentsFactory;
use \Magento\Framework\Exception\NoSuchEntityException;

class Update extends Action
{

/**
 * @var StudentsFactory
 */
protected $studentsFactory;

public function __construct(
    Action\Context $context,
    StudentsFactory $studentsFactory
)
{
    $this->studentsFactory = $studentsFactory;
    parent::__construct($context);
}

/**
 *  Load Student data by given Student Id
 *
 * @return $student
 * @throws NoSuchEntityException
 */

public function execute()
{

    $id = $this->getRequest()->getParam('id');
    $student = $this->studentsFactory->create();
    $student->load($id);

    return $student;
}
}
1
source | link

Magento 2.2.5: Exception #0 (InvalidArgumentException): Invalid return type

i'm doing update "students" on magento 2.2.5
and i'm stuck in how to get student data by id
the error say:

1 exception(s):
Exception #0 (InvalidArgumentException): Invalid return type

here is my code:

<?php

namespace Fudu\HelloWorld\Controller\Adminhtml\Student;

use Magento\Backend\App\Action;
use Fudu\HelloWorld\Model\StudentsFactory;
use \Magento\Framework\Exception\NoSuchEntityException;

class Update extends Action
{

/**
 * @var StudentsFactory
 */
protected $studentsFactory;

public function __construct(
    Action\Context $context,
    StudentsFactory $studentsFactory
)
{
    $this->studentsFactory = $studentsFactory;
    parent::__construct($context);
}

/**
 *  Load Student data by given Student Id
 *
 * @return $student
 * @throws NoSuchEntityException
 */

public function execute()
{

    $id = $this->getRequest()->getParam('id');
    $student = $this->studentsFactory->create();
    $student->load($id);

    return $student;
}
}

thanks for reading