Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When creating servers, they now always have a 0 status (having the nasty side effect that they can't be deleted). Weirdly enough, creating indexes works normally.
From some quick debugging I can't really tell the cause. The SQL default value for the column is 1 (and the whole definition is the same as for indexes). Right before the initial call to save()
, $server->entity
is NULL
, as it should be. And I really have no idea where else something could go wrong. In the INSERT statement, the wrong value is already there.
Any ideas?
Comments
Comment #1
fagoWhat about is $server->entity ?
Maybe you have the status property defined in your class, such that it already exists and db default is not populated?
Comment #2
drunken monkeyOh, sorry, I meant
$server->status
. This isNULL
when I callsave()
, but obviously gets changed to 0 between then and the database statement.It's defined with
public $status;
, so it should beNULL
if it isn't set explicitly — and, as said above, it isNULL
when the method is called.Comment #3
fagodrupal_write_record() makes use property_exists($object, $field) - so the default won't be applied that way. So either specify the right default value for the class property too, or remove it.
Comment #4
drunken monkeyOh, wow. Doesn't seem like the most logical thing to do, but there's probably some reason for this …
Anyways, thanks a lot for finding that out, should be fixed for the Search API now.