Failing to create DateTime attribute in Express object programmatically

Permalink 1 user found helpful

In regards to creating Express object programmatically, I am failing to create DateTime attribute. I am referencing the documentation and the forum post listed below:


I added the code below in controller.php of my package:

public function install()
        $pkg = parent::install();
        // Create Express object
        $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->addAttribute('datetime', 'Birthday', 'birthday');
        // Create form
        $form = $student->buildForm('Form');

When I install my package, Concrete5 throws error "Call to a member function getController() on null".

Would anyone guide me how to add a datetime attribute in Express object and its form? Thank you in advance for your help!

View Replies: