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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoBackendAppAction;
use FuduHelloWorldModelStudentsFactory;
use MagentoFrameworkExceptionNoSuchEntityException;
class Update extends Action
{
/**
* @var StudentsFactory
*/
protected $studentsFactory;
public function __construct(
ActionContext $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;
}
}
magento2.2 factory
|
show 2 more comments
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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoBackendAppAction;
use FuduHelloWorldModelStudentsFactory;
use MagentoFrameworkExceptionNoSuchEntityException;
class Update extends Action
{
/**
* @var StudentsFactory
*/
protected $studentsFactory;
public function __construct(
ActionContext $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;
}
}
magento2.2 factory
1
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48
|
show 2 more comments
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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoBackendAppAction;
use FuduHelloWorldModelStudentsFactory;
use MagentoFrameworkExceptionNoSuchEntityException;
class Update extends Action
{
/**
* @var StudentsFactory
*/
protected $studentsFactory;
public function __construct(
ActionContext $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;
}
}
magento2.2 factory
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 FuduHelloWorldControllerAdminhtmlStudent;
use MagentoBackendAppAction;
use FuduHelloWorldModelStudentsFactory;
use MagentoFrameworkExceptionNoSuchEntityException;
class Update extends Action
{
/**
* @var StudentsFactory
*/
protected $studentsFactory;
public function __construct(
ActionContext $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;
}
}
magento2.2 factory
magento2.2 factory
edited 28 mins ago
Teja Bhagavan Kollepara
2,94841847
2,94841847
asked Jul 20 '18 at 8:27
fudufudu
38411
38411
1
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48
|
show 2 more comments
1
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48
1
1
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48
|
show 2 more comments
3 Answers
3
active
oldest
votes
Reason for error is you can not return Object type of FuduHelloWorldModelStudentsFactory
In controller execute method.
Return type for controller should be :
“Json” result (return json type of data)
“Raw” result (plain string)
“Forward” result ($result->forward('noroute'); )
“Redirect” result ( $result->setPath('');)
You can read more on it source
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
add a comment |
@return $student
to @return FuduHelloWorldModelStudents
/**
* Load Student data by given Student Id
*
* @return FuduHelloWorldModelStudents
* @throws NoSuchEntityException
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$student = $this->studentsFactory->create();
$student->load($id);
return $student;
}
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined$student
type.@return
can bedefine type (string, int, array,..)
ormodel object
with full path.
– Bong Channarith
Jul 20 '18 at 9:00
you can find return typeMagentoFrameworkControllerResult..
for controller.
– Bong Channarith
Jul 20 '18 at 9:06
add a comment |
Turn out i cant use controller to return a object, and i have to use block to do that.
so my block is
public function getStudentById(){
$id = $this->getRequest()->getParam('id');
$student = $this->_studentsFactory->create();
$student->load($id);
return $student;
}
and then in my phtml file
<?php /** @var FuduHelloWorldBlockAdminhtmlStudentsBlock $block */ ?>
<form action="<?php echo $block->getPostUpdateStudentsUrl() ?>" method="post"
style="border: 1px solid black; width: 200px; height: 250px; padding-left:10px;">
Name:<br>
<input type="text" name="name" required value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Class:<br>
<input type="number" name="class_id" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Gender:<br>
<input type="text" name="gender" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Age:<br>
<input type="number" name="age" value=<?php echo $block->getStudentById()->getName() ?>>
<br><br>
<input type="submit" value="Submit">
</form>
thanks all for your help.
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
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%2f235265%2fmagento-2-2-5-exception-0-invalidargumentexception-invalid-return-type%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
Reason for error is you can not return Object type of FuduHelloWorldModelStudentsFactory
In controller execute method.
Return type for controller should be :
“Json” result (return json type of data)
“Raw” result (plain string)
“Forward” result ($result->forward('noroute'); )
“Redirect” result ( $result->setPath('');)
You can read more on it source
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
add a comment |
Reason for error is you can not return Object type of FuduHelloWorldModelStudentsFactory
In controller execute method.
Return type for controller should be :
“Json” result (return json type of data)
“Raw” result (plain string)
“Forward” result ($result->forward('noroute'); )
“Redirect” result ( $result->setPath('');)
You can read more on it source
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
add a comment |
Reason for error is you can not return Object type of FuduHelloWorldModelStudentsFactory
In controller execute method.
Return type for controller should be :
“Json” result (return json type of data)
“Raw” result (plain string)
“Forward” result ($result->forward('noroute'); )
“Redirect” result ( $result->setPath('');)
You can read more on it source
Reason for error is you can not return Object type of FuduHelloWorldModelStudentsFactory
In controller execute method.
Return type for controller should be :
“Json” result (return json type of data)
“Raw” result (plain string)
“Forward” result ($result->forward('noroute'); )
“Redirect” result ( $result->setPath('');)
You can read more on it source
answered Jul 20 '18 at 9:03
Dhaval SolankiDhaval Solanki
1,3691932
1,3691932
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
add a comment |
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
if it worked you can accept my answer
– Dhaval Solanki
Jul 20 '18 at 9:05
add a comment |
@return $student
to @return FuduHelloWorldModelStudents
/**
* Load Student data by given Student Id
*
* @return FuduHelloWorldModelStudents
* @throws NoSuchEntityException
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$student = $this->studentsFactory->create();
$student->load($id);
return $student;
}
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined$student
type.@return
can bedefine type (string, int, array,..)
ormodel object
with full path.
– Bong Channarith
Jul 20 '18 at 9:00
you can find return typeMagentoFrameworkControllerResult..
for controller.
– Bong Channarith
Jul 20 '18 at 9:06
add a comment |
@return $student
to @return FuduHelloWorldModelStudents
/**
* Load Student data by given Student Id
*
* @return FuduHelloWorldModelStudents
* @throws NoSuchEntityException
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$student = $this->studentsFactory->create();
$student->load($id);
return $student;
}
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined$student
type.@return
can bedefine type (string, int, array,..)
ormodel object
with full path.
– Bong Channarith
Jul 20 '18 at 9:00
you can find return typeMagentoFrameworkControllerResult..
for controller.
– Bong Channarith
Jul 20 '18 at 9:06
add a comment |
@return $student
to @return FuduHelloWorldModelStudents
/**
* Load Student data by given Student Id
*
* @return FuduHelloWorldModelStudents
* @throws NoSuchEntityException
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$student = $this->studentsFactory->create();
$student->load($id);
return $student;
}
@return $student
to @return FuduHelloWorldModelStudents
/**
* Load Student data by given Student Id
*
* @return FuduHelloWorldModelStudents
* @throws NoSuchEntityException
*/
public function execute()
{
$id = $this->getRequest()->getParam('id');
$student = $this->studentsFactory->create();
$student->load($id);
return $student;
}
answered Jul 20 '18 at 8:49
Bong ChannarithBong Channarith
410111
410111
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined$student
type.@return
can bedefine type (string, int, array,..)
ormodel object
with full path.
– Bong Channarith
Jul 20 '18 at 9:00
you can find return typeMagentoFrameworkControllerResult..
for controller.
– Bong Channarith
Jul 20 '18 at 9:06
add a comment |
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined$student
type.@return
can bedefine type (string, int, array,..)
ormodel object
with full path.
– Bong Channarith
Jul 20 '18 at 9:00
you can find return typeMagentoFrameworkControllerResult..
for controller.
– Bong Channarith
Jul 20 '18 at 9:06
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Can you please explain what exactly you asking to change ?
– Dhaval Solanki
Jul 20 '18 at 8:56
Magento cannot defined
$student
type. @return
can be define type (string, int, array,..)
or model object
with full path.– Bong Channarith
Jul 20 '18 at 9:00
Magento cannot defined
$student
type. @return
can be define type (string, int, array,..)
or model object
with full path.– Bong Channarith
Jul 20 '18 at 9:00
you can find return type
MagentoFrameworkControllerResult..
for controller.– Bong Channarith
Jul 20 '18 at 9:06
you can find return type
MagentoFrameworkControllerResult..
for controller.– Bong Channarith
Jul 20 '18 at 9:06
add a comment |
Turn out i cant use controller to return a object, and i have to use block to do that.
so my block is
public function getStudentById(){
$id = $this->getRequest()->getParam('id');
$student = $this->_studentsFactory->create();
$student->load($id);
return $student;
}
and then in my phtml file
<?php /** @var FuduHelloWorldBlockAdminhtmlStudentsBlock $block */ ?>
<form action="<?php echo $block->getPostUpdateStudentsUrl() ?>" method="post"
style="border: 1px solid black; width: 200px; height: 250px; padding-left:10px;">
Name:<br>
<input type="text" name="name" required value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Class:<br>
<input type="number" name="class_id" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Gender:<br>
<input type="text" name="gender" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Age:<br>
<input type="number" name="age" value=<?php echo $block->getStudentById()->getName() ?>>
<br><br>
<input type="submit" value="Submit">
</form>
thanks all for your help.
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
add a comment |
Turn out i cant use controller to return a object, and i have to use block to do that.
so my block is
public function getStudentById(){
$id = $this->getRequest()->getParam('id');
$student = $this->_studentsFactory->create();
$student->load($id);
return $student;
}
and then in my phtml file
<?php /** @var FuduHelloWorldBlockAdminhtmlStudentsBlock $block */ ?>
<form action="<?php echo $block->getPostUpdateStudentsUrl() ?>" method="post"
style="border: 1px solid black; width: 200px; height: 250px; padding-left:10px;">
Name:<br>
<input type="text" name="name" required value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Class:<br>
<input type="number" name="class_id" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Gender:<br>
<input type="text" name="gender" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Age:<br>
<input type="number" name="age" value=<?php echo $block->getStudentById()->getName() ?>>
<br><br>
<input type="submit" value="Submit">
</form>
thanks all for your help.
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
add a comment |
Turn out i cant use controller to return a object, and i have to use block to do that.
so my block is
public function getStudentById(){
$id = $this->getRequest()->getParam('id');
$student = $this->_studentsFactory->create();
$student->load($id);
return $student;
}
and then in my phtml file
<?php /** @var FuduHelloWorldBlockAdminhtmlStudentsBlock $block */ ?>
<form action="<?php echo $block->getPostUpdateStudentsUrl() ?>" method="post"
style="border: 1px solid black; width: 200px; height: 250px; padding-left:10px;">
Name:<br>
<input type="text" name="name" required value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Class:<br>
<input type="number" name="class_id" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Gender:<br>
<input type="text" name="gender" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Age:<br>
<input type="number" name="age" value=<?php echo $block->getStudentById()->getName() ?>>
<br><br>
<input type="submit" value="Submit">
</form>
thanks all for your help.
Turn out i cant use controller to return a object, and i have to use block to do that.
so my block is
public function getStudentById(){
$id = $this->getRequest()->getParam('id');
$student = $this->_studentsFactory->create();
$student->load($id);
return $student;
}
and then in my phtml file
<?php /** @var FuduHelloWorldBlockAdminhtmlStudentsBlock $block */ ?>
<form action="<?php echo $block->getPostUpdateStudentsUrl() ?>" method="post"
style="border: 1px solid black; width: 200px; height: 250px; padding-left:10px;">
Name:<br>
<input type="text" name="name" required value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Class:<br>
<input type="number" name="class_id" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Gender:<br>
<input type="text" name="gender" value=<?php echo $block->getStudentById()->getName() ?>>
<br>
Age:<br>
<input type="number" name="age" value=<?php echo $block->getStudentById()->getName() ?>>
<br><br>
<input type="submit" value="Submit">
</form>
thanks all for your help.
answered Jul 20 '18 at 9:04
fudufudu
38411
38411
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
add a comment |
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
– Mohit Kumar Arora
Jul 20 '18 at 9:23
its the final answer here
– fudu
Jul 20 '18 at 9:40
its the final answer here
– fudu
Jul 20 '18 at 9:40
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%2f235265%2fmagento-2-2-5-exception-0-invalidargumentexception-invalid-return-type%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
1
I think issue is with returning $student object. I am not sure but it may be throwing error because you are returning object through controller.
– Dhaval Solanki
Jul 20 '18 at 8:35
i delete the * return $student in " /** * Load Student data by given Student Id * * return $student * throws NoSuchEntityException */ " but doesn't work too
– fudu
Jul 20 '18 at 8:38
what error you are getting after removing it ?
– Dhaval Solanki
Jul 20 '18 at 8:42
the same as before
– fudu
Jul 20 '18 at 8:42
wait , did you say i cant return something from a controller?
– fudu
Jul 20 '18 at 8:48