$value ] ); if ( ! $result ) { return null; } return new self( [ 'data' => $result ] ); } public static function insert_one( Script_DTO $dto ): Script_Entry { $entry = new self(); foreach ( $dto->to_entry() as $key => $value ) { $entry->set( $key, $value ); } $entry->create(); return $entry; } public static function update_one( int $id, Script_DTO $dto ): void { $entry = new self( [ 'id' => $id ] ); foreach ( $dto->to_entry() as $key => $value ) { $entry->set( $key, $value ); } $entry->save(); } public static function detach_from_cookie( int $cookie_id ): void { Script_Table::update( [ Script_Table::COOKIE_ID => null ], [ Script_Table::COOKIE_ID => $cookie_id ] ); } public static function retag_for_cookie( int $cookie_id, string $category ): void { Script_Table::update( [ Script_Table::CATEGORY => $category ], [ Script_Table::COOKIE_ID => $cookie_id ] ); } }