Skip to content

Commit

Permalink
Merge pull request #226 from NotFoundNL/develop
Browse files Browse the repository at this point in the history
feat!: Version 0.19.2
  • Loading branch information
64knl committed Mar 22, 2024
2 parents a41a897 + 0e2d4f6 commit e630517
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 53 deletions.
5 changes: 3 additions & 2 deletions src/Http/Controllers/CmsEditor/CmsEditorTableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace NotFound\Framework\Http\Controllers\CmsEditor;

use Illuminate\Http\Request as HttpRequest;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use NotFound\Framework\Http\Requests\FormDataRequest;
use NotFound\Framework\Models\Table;
Expand Down Expand Up @@ -323,7 +322,9 @@ private function checkColumn(string $table, object $field): string
$fieldClass = new $className(new stdClass());

if (Schema::hasColumn($table, $field->internal)) {
return $fieldClass->checkColumnType(DB::getDoctrineColumn($this->setDatabasePrefix($table), $field->internal)->getType());
return $fieldClass->checkColumnType(
Schema::getColumnType($table, $field->internal)
);
} else {
return $fieldClass->checkColumnType(null);
}
Expand Down
7 changes: 0 additions & 7 deletions src/Services/Assets/Components/ComponentText.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ protected function customProperties(): object
$customProperties['editorSettings'] = json_decode($setting->settings);
}
}
if (
$this->assetItem->properties->type == 'richtext' &&
isset($this->assetItem->server_properties->editModal) &&
$this->assetItem->server_properties->editModal === true
) {
$customProperties['editModal'] = true;
}

return (object) $customProperties;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
return '';
}
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}

if (! in_array($type->getName(), ['tinyint', 'boolean'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a text field';
if (! in_array($type, ['tinyint', 'int', 'boolean'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a text field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/ChildTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function rename(): array
];
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type !== null) {
return 'COLUMN NOT NEEDED';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/ContentBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function serverProperties(): void

}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type !== null) {
return 'COLUMN NOT NEEDED';
Expand Down
10 changes: 5 additions & 5 deletions src/Services/Editor/Fields/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ protected function rename(): array
];
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if ($type->getName() === 'int') {
return 'TYPE WARNING: '.$type->getName().' should be converted to datetime';
if ($type === 'int') {
return 'TYPE WARNING: '.$type.' should be converted to datetime';
}

if ($type->getName() !== 'datetime') {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a date field';
if ($type !== 'datetime') {
return 'TYPE ERROR: '.$type.' is not a valid type for a date field';
}

return '';
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/DateTimePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if (! in_array($type->getName(), ['datetime'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a date field';
if (! in_array($type, ['datetime'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a date field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{

return '';
Expand Down
3 changes: 1 addition & 2 deletions src/Services/Editor/Fields/DropDown.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace NotFound\Framework\Services\Editor\Fields;

use Doctrine\DBAL\Types\Type;
use NotFound\Framework\Services\Editor\Properties;
use NotFound\Framework\Services\Editor\Repeatable;
use stdClass;
Expand Down Expand Up @@ -30,7 +29,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}

if (! in_array($type->getName(), ['string'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a text field';
if (! in_array($type, ['varchar'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a text field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
return '';
}
Expand Down
3 changes: 1 addition & 2 deletions src/Services/Editor/Fields/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace NotFound\Framework\Services\Editor\Fields;

use Doctrine\DBAL\Types\Type;
use NotFound\Framework\Services\Editor\Properties;
use NotFound\Framework\Services\Editor\Repeatable;
use stdClass;
Expand Down Expand Up @@ -36,7 +35,7 @@ public function serverProperties(): void
$this->addCheckbox('createPNG', 'Create PNG');
}

public function checkColumnType(?Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/ModelSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public function serverProperties(): void
$this->addText('methodName', 'Method', true);
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if (! in_array($type->getName(), ['string', 'integer'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a table select field';
if (! in_array($type, ['varchar', 'int'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a table select field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public function serverProperties(): void
$this->addText('source', 'Source field internal name', false);
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if (! in_array($type->getName(), ['string'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a slug field';
if (! in_array($type, ['varchar'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a slug field';
}

return '';
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Editor/Fields/TableSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ protected function rename(): array
];
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if (! in_array($type->getName(), ['string', 'integer'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a table select field';
if (! in_array($type, ['int', 'tinyint', 'varchar'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a table select field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Fields/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function rename(): array
];
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type !== null) {
return 'COLUMN NOT NEEDED';
Expand Down
8 changes: 4 additions & 4 deletions src/Services/Editor/Fields/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function properties(): void
(object) ['value' => 'richtext', 'label' => 'Rich Text'],
]);
$this->addNumber('maxlength', 'Maximum length');
$this->addCheckbox('editModal', 'Edit texts in popup (required for ContentBlock/Childtable)');
}

public function serverProperties(): void
Expand All @@ -36,7 +37,6 @@ public function serverProperties(): void
$this->addDropDown('editorSettings', 'Editor settings (for rich text editor)', $options);
// BUG: TODO: editModal should just be a property,
// not a server property
$this->addCheckbox('editModal', 'Edit texts in popup (required for ContentBlock/Childtable)');
$this->addTitle('Validation');

$this->addDropDown('regExTemplate', 'Built in validations', [
Expand All @@ -54,13 +54,13 @@ public function rename(): array
return ['texttype' => 'type'];
}

public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string
public function checkColumnType(?string $type): string
{
if ($type === null) {
return 'COLUMN MISSING';
}
if (! in_array($type->getName(), ['string', 'text'])) {
return 'TYPE ERROR: '.$type->getName().' is not a valid type for a text field';
if (! in_array($type, ['varchar', 'text'])) {
return 'TYPE ERROR: '.$type.' is not a valid type for a text field';
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/Properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract public function serverProperties(): void;

abstract public function description(): string;

abstract public function checkColumnType(?\Doctrine\DBAL\Types\Type $type): string;
abstract public function checkColumnType(?string $type): string;

protected function addText($property_name, $display_name, $required = false, $default = null)
{
Expand Down
4 changes: 1 addition & 3 deletions src/Services/Editor/Repeatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace NotFound\Framework\Services\Editor;

use Doctrine\DBAL\Types\Type;

class Repeatable extends Properties
{
public function description(): string
Expand All @@ -19,7 +17,7 @@ public function serverProperties(): void
{
}

public function checkColumnType(?Type $type): string
public function checkColumnType(?string $type): string
{
trigger_error('This should never be called', E_USER_ERROR);

Expand Down

0 comments on commit e630517

Please sign in to comment.