Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update namespace. Add table_name config to all models #39

Merged
merged 3 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
chrispenny marked this conversation as resolved.
Show resolved Hide resolved

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';
chrispenny marked this conversation as resolved.
Show resolved Hide resolved

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';
chrispenny marked this conversation as resolved.
Show resolved Hide resolved

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';
chrispenny marked this conversation as resolved.
Show resolved Hide resolved

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';
chrispenny marked this conversation as resolved.
Show resolved Hide resolved

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