Hi there,
I have had the same issue and finally dug into it and solved the issue.
The problem lies in the fact that a Joomla Table has an method "store". That has an argument called "$updateNullValues"
By default, this argument is never used.
Also, the method "bind" ignores values which have a NULL value.
Effectively, this leads to NULL values not being updated at all
To be able to clear the datetime field (aka set is to NULL), you have to:
- Fork the table
- Override bind() and store()
I have forked my class table (file is fork/tables/class.php), you can start with making a copy of the table you need to override from "_fork" folder, either in administrator or site root, depending on your need.
Met code inside my forked class.php:
class ShowmanagerTableClass extends ShowmanagerCkTableClass
{
public function store($updateNulls = true) {
//updateNull will be true if not set, resulting in Joomla updating NULL values as well.
//Call parent
return parent::store($updateNulls);
}
public function bind($src, $ignore = array())
{
$result = parent::bind($src, $ignore);
//override to allow NULL in time fields
foreach ($this->getProperties() as $k => $v)
{
// Only process fields not in the ignore array.
if (!in_array($k, $ignore))
{
//you can remove the whole if statement as well, or explicitly list the fields needed
if (isset($src[$k]) || $k == 'time_per_contestant' || $k == 'time_per_class' || $k == 'time_ceremony_per_contestant')
{
$this->$k = $src[$k];
}
}
}
return $result;
}
}
Hope it helps!