<commit_before><?php

namespace Soda\Cms\Models\Observers;

use Soda\Cms\Models\ModelBuilder;
use Soda\Cms\Models\Page;

class PageObserver
{
    /**
     * Listen to the Page saved event.
     *
     * @param \Soda\Cms\Models\Page $page
     */
    public function created(Page $page)
    {
        ModelBuilder::fromTable('soda_' . $page->type->identifier)->create(['page_id' => $page->id]);
    }
}
<commit_msg>only create dynamic row if page_type_id is set<commit_after><?php

namespace Soda\Cms\Models\Observers;

use Soda\Cms\Models\ModelBuilder;
use Soda\Cms\Models\Page;

class PageObserver
{
    /**
     * Listen to the Page saved event.
     *
     * @param \Soda\Cms\Models\Page $page
     */
    public function created(Page $page)
    {
        if($page->page_type_id !== null) {
            //if(!$page->type) $page->load('type');
            ModelBuilder::fromTable('soda_' . $page->type->identifier)->create(['page_id' => $page->id]);
        }
    }
}

{'fraction_non_alphanumeric': 0.16082474226804125, 'fraction_numerical': 0.0, 'mean_word_length': 2.7346153846153847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4923050', 'n_tokens_mistral': 333, 'n_tokens_neox': 336, 'n_words': 61}