Skip to content

Commit

Permalink
Shorten the "title" field to fit in the database
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbgodin authored and Simounet committed Feb 28, 2023
1 parent ba69083 commit 84e520e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Event.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function getTitle(){
}

function setTitle($title){
$this->title = $title;
$this->title = mb_substr($title, 0, self::LEN_STRING);
}

function getContent(){
Expand Down
3 changes: 2 additions & 1 deletion MysqlEntity.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class MysqlEntity
private $debug = false;
private $debugAllQuery = false;

const LEN_STRING = 225;

function sgbdType($type){
$return = false;
switch($type){
case 'string':
case 'timestamp':
$return = 'VARCHAR(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci';
$return = 'VARCHAR('.self::LEN_STRING.') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci';
break;
case 'longstring':
$return = 'TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci';
Expand Down

0 comments on commit 84e520e

Please sign in to comment.