Skip to content

Commit

Permalink
Add table_name config to all models
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispenny committed Nov 14, 2021
1 parent 3e0f699 commit 63cd7df
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Models/EmailLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
class EmailLink extends Link
{

private static $table_name = 'Link_EmailLink';

private static $db = [
'Email' => 'Varchar(255)'
];
Expand Down
3 changes: 2 additions & 1 deletion src/Models/ExternalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
class ExternalLink extends Link
{

private static $table_name = 'Link_ExternalLink';

private static $db = [
'ExternalUrl' => 'Varchar'
];


public function generateLinkDescription(array $data): string
{
return isset($data['ExternalUrl']) ? $data['ExternalUrl'] : '';
Expand Down
4 changes: 3 additions & 1 deletion src/Models/FileLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@

/**
* A link to a File track in asset-admin
*
* @property File $File
* @property int $FileID
*/
class FileLink extends Link
{

private static $table_name = 'Link_FileLink';

private static $has_one = [
'File' => File::class
];


public function generateLinkDescription(array $data): string
{
if (empty($data['FileID'])) {
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
class Link extends DataObject implements JsonData, Type
{

private static $table_name = 'Link';

private static $db = [
'Title' => 'Varchar',
'OpenInNew' => 'Boolean'
Expand Down
3 changes: 2 additions & 1 deletion src/Models/SiteTreeLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
class SiteTreeLink extends Link
{

private static $table_name = 'Link_SiteTreeLink';

private static $db = [
'Anchor' => 'Varchar'
];
Expand All @@ -24,7 +26,6 @@ class SiteTreeLink extends Link
'Page' => SiteTree::class
];


public function generateLinkDescription(array $data): string
{
if (empty($data['PageID'])) {
Expand Down

0 comments on commit 63cd7df

Please sign in to comment.