Error When Programmatically Creating Express Object Form

Permalink
Hi,
I run provided code for creating Express Objects Form on this document:
https://documentation.concrete5.org/developers/express/programmatica...
$student = Express::buildObject('student', 'students', 'Student', $pkg);
$student->addAttribute('text', 'First Name', 'first_name');
$student->addAttribute('text', 'Last Name', 'last_name');
$student->addAttribute('textarea', 'Bio', 'bio');
$student->save();
$form = $student->buildForm('Form');
$form->addFieldset('Basics')
    ->addAttributeKeyControl('first_name')
    ->addAttributeKeyControl('last_name')
    ->addTextControl('', 'This is just some basic explanatory text.')
    ->addAttributeKeyControl('bio');
$form = $form->save();

It creates the form, but when i try add an element, it result an error. Can anybody know a workaround for this?

shahroq
View Replies: