Open philipmarnef opened 4 years ago
Following up: I didn't add
'autoid' => autoid()
to the $props array. When I do, it works.
I'm guessing the autoID is added in a hook which changes the page between create & update so $page->update()
doesn't resolve?
i never tried with Page::create
but used $parent->createChild()
.
it would be a problem if the autoid registered hook at create changed the object and breaks expected behaviour. the only way around that is using a custom create method add add the autoid there https://getkirby.com/kosmos/45#kirby-tip-of-the-month
i will think about adding a AutoidPage
to inherit from that avoids this.
class AutoidPage extends Page
{
public static function create(array $props): Page
{
$props['autoid') = autoid(); // generate new
return parent::create($props);
}
}
I have blueprint with an autoid field. If I try this:
The updated fields are in the $page object, but the .txt file is not updated.
Problem is gone when I remove the autoid field.