Express object form not created

Permalink
Creating Express object worked fine and I need to create form for it as well. The form is created and the field set 'basics' is appearing as well but there are no fields in the Basics field set. Here's the code I used. It's basically a copy paste from the docs but not working.

$entity = Express::getObjectByHandle('user');
       if(!is_object($entity)){
          $entity = Express::buildObject('user', 'users', 'Users');
          $entity->addAttribute('text', 'First Name', 'user_first_name');
         $entity->addAttribute('text', 'Last Name', 'user_last_name');
         $entity->addAttribute('text', 'Company Name', 'user_company_name');
         $entity->addAttribute('text', 'Job Title', 'user_job_title');
         $entity->addAttribute('number', 'Mobile', 'user_mobile');
         $entity->addAttribute('text', 'Session 1', 'user_session_one');
         $entity->addAttribute('text', 'Session 2', 'user_session_two');
         $entity->addAttribute('text', 'Download Link', 'user_download_link');
         $entity->save();
          $form = $entity->buildForm('Form');
         $form->addFieldset('Basics')
             ->addAttributeKeyControl('user_first_name')

 
aravindmj replied on at Permalink Reply
Have one more related(I think) problem. I am reading a CSV and Creating Entry from it. That works just fine. They are listing. The problem is when I try to view them. The following error pops up.
Argument 1 passed to Concrete\Core\Express\Form\AbstractRenderer::__construct() must implement interface Concrete\Core\Express\Form\FormInterface, null given

Any help appreciated :)
aravindmj replied on at Permalink Reply
I Solved this problem. It's just that the default form for view and edit was not being set in edit entity option. Also I couldn't find code to do that either.
pixelhero replied on at Permalink Reply
pixelhero
Having this exact same problem, can create the Object, Attributes, Form and Fieldset, but not the actual fields being put inside the fieldset
aravindmj replied on at Permalink Reply
I dropped creating form programmatically lol. Now I have to sit up and do them all manually.... soo frustrating....
linuxoid replied on at Permalink Reply
linuxoid
I found that if the entity has been created with errors during a package installation, then you delete the package, change the code, reinstall the package - the old entity (assuming it's the same name) is still preserved.

After I uninstalled the package, deleted the entity manually in the Dashboard, reinstalled the package - the default form appeared.