Home>

I'm new to cakephp
Official tutorial working on cms app
Corresponding page url

I've heard that some code can't be used because the version translation can't keep up.
I didn't hit a page that I could google.
Please help +-+;

Corresponding source code
<? php
namespace App \ Model \ Table;
use Cake \ ORM \ Table;
use Cake \ Utility \ Text;
use Cake \ Event \ EventInterface;
public function beforeSave (EventInterface $event, $entity, $options)
{
    if ($entity->isNew ()&&! $entity->slug) {
        $sluggedTitle = Text :: slug ($entity->title);
        $entity->slug = substr ($sluggedTitle, 0, 191);
    }
}
What I tried

Check the method introduction page of the official tutorial

Supplementary information (FW/tool version, etc.)

cakephp4, xampp