/home/u433713558/domains/weegosoft.com/public_html/training/src/Table/PostTable.php
{
$return = $this->findFirst(['fields'=>'guid',
'clauses'=>"id=$id",
]) ;
if($return){
return $return->getGUID();
}
return $default ;
}
public function findBySlug(string $slug):?Post
{
$return = $this->findFirst([
'clauses'=>"slug='$slug'",
]) ;
if ($return===false) {
throw new NotFoundException($this->table);
}
return $return ;
}
public function findByParent(int $parent):?array
{
$return = $this->find(['fields'=>'*',
'clauses'=>"parent=$parent",
]) ;
return $return ;
}
//update a post
public function update(Post $post):void
{
$save = $this->save([
'id'=>$post->getId(),