M
M
MrFlatman2018-01-06 12:08:25
CakePHP
MrFlatman, 2018-01-06 12:08:25

Fix function create() on null?

Getting started with CakePHP
When executing a line, <?php echo $form->create('Task');?>
it gives an error
Call to a member function create() on null
Error: An Internal Error Has Occurred

Can you tell me how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2018-01-06
@alexey-m-ukolov

Check if the $form object is initialized (it is not initialized for you).
Head-on solution:

<?php echo ($form ? $form->create('Task') : ''); ?>

But it’s more correct, of course, to figure out in which place above in the code the problem with creating an object.

M
Marat Dallin, 2018-10-30
@amr-dallin

What version of CakePHP are you running?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question