Skip to content

Commit

Permalink
Added field enablePagination to Endpoint.php
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoLouwerse committed Sep 3, 2024
1 parent 03ad272 commit a929424
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 57 deletions.
31 changes: 31 additions & 0 deletions api/migrations/Version20240903110000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240903110000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Added the field enablePagination (enable_pagination) to Endpoint Table';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE endpoint ADD enable_pagination BOOLEAN DEFAULT true');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE endpoint DROP enable_pagination');
}
}
127 changes: 70 additions & 57 deletions api/src/Entity/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,22 @@ class Endpoint
private ?string $tag = null;

/**
* @var bool Whether or not the proxy should overrule the authentication from the request.
* @var bool Whether the proxy should override the authentication in the request.
*
* @Groups({"read", "write"})
* @ORM\Column(type="boolean", options={"default":false}, nullable=true)
*/
private ?bool $proxyOverrulesAuthentication = false;

/**
* @var bool Whether this endpoint should show paginated results for GET collection API Requests.
* If set to false the response will only contain an array of results without "results":[].
*
* @Groups({"read", "write"})
* @ORM\Column(type="boolean", options={"default":true}, nullable=true)
*/
private ?bool $enablePagination = true;

/**
* @var array|null The path of this Endpoint.
*
Expand Down Expand Up @@ -444,6 +453,9 @@ public function fromSchema(array $schema, array $default = [])
array_key_exists('tags', $schema) ? $this->setTags($schema['tags']) : '';
array_key_exists('entities', $schema) ? $this->setEntities($schema['entities']) : '';

if (array_key_exists('enablePagination', $schema) === true) {
$this->setEnablePagination($schema['enablePagination']);
}
if (array_key_exists('loggingConfig', $schema) === true) {
$this->setLoggingConfig($schema['loggingConfig']);
}
Expand Down Expand Up @@ -493,6 +505,7 @@ public function toSchema(): array
'method' => $this->getMethod(),
'throws' => $this->getThrows(),
'defaultContentType' => $this->getDefaultContentType(),
'enablePagination' => $this->getEnablePagination(),
'tag' => $this->getTag(),
'tags' => $this->getTags(),
'proxy' => $this->getProxy() !== null ? $this->getProxy()->toSchema() : null,
Expand Down Expand Up @@ -572,18 +585,6 @@ public function setName(?string $name): self
return $this;
}

public function getMethod(): ?string
{
return $this->method;
}

public function setMethod(?string $method): self
{
$this->method = $method;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
Expand All @@ -608,74 +609,62 @@ public function setPathRegex(?string $pathRegex): self
return $this;
}

public function getTag(): ?string
{
return $this->tag;
}

public function setTag(?string $tag): self
{
$this->tag = $tag;

return $this;
}

public function getPath(): ?array
public function getMethod(): ?string
{
return $this->path;
return $this->method;
}

public function setPath(array $path): self
public function setMethod(?string $method): self
{
$this->path = $path;
$this->method = $method;

return $this;
}

public function getParameters(): ?array
public function getTag(): ?string
{
return $this->parameters;
return $this->tag;
}

public function setParameters(array $parameters): self
public function setTag(?string $tag): self
{
$this->parameters = $parameters;
$this->tag = $tag;

return $this;
}

public function getMethods(): ?array
public function getProxyOverrulesAuthentication(): ?bool
{
return $this->methods;
return $this->proxyOverrulesAuthentication;
}

public function setMethods(?array $methods): self
public function setProxyOverrulesAuthentication(bool $proxyOverrulesAuthentication): self
{
$this->methods = $methods;
$this->proxyOverrulesAuthentication = $proxyOverrulesAuthentication;

return $this;
}

public function getThrows(): ?array
public function getEnablePagination(): ?bool
{
return $this->throws;
return $this->enablePagination;
}

public function setThrows(?array $throws): self
public function setEnablePagination(bool $enablePagination): self
{
$this->throws = $throws;
$this->enablePagination = $enablePagination;

return $this;
}

public function getStatus(): ?bool
public function getPath(): ?array
{
return $this->status;
return $this->path;
}

public function setStatus(?bool $status): self
public function setPath(array $path): self
{
$this->status = $status;
$this->path = $path;

return $this;
}
Expand Down Expand Up @@ -782,6 +771,42 @@ public function setPathArray(?array $pathArray): self
return $this;
}

public function getMethods(): ?array
{
return $this->methods;
}

public function setMethods(?array $methods): self
{
$this->methods = $methods;

return $this;
}

public function getThrows(): ?array
{
return $this->throws;
}

public function setThrows(?array $throws): self
{
$this->throws = $throws;

return $this;
}

public function getStatus(): ?bool
{
return $this->status;
}

public function setStatus(?bool $status): self
{
$this->status = $status;

return $this;
}

/**
* @return Collection|Property[]
*/
Expand Down Expand Up @@ -989,16 +1014,4 @@ public function removeFederationProxy(Gateway $federationProxy): self

return $this;
}

public function getProxyOverrulesAuthentication(): ?bool
{
return $this->proxyOverrulesAuthentication;
}

public function setProxyOverrulesAuthentication(bool $proxyOverrulesAuthentication): self
{
$this->proxyOverrulesAuthentication = $proxyOverrulesAuthentication;

return $this;
}
}

0 comments on commit a929424

Please sign in to comment.