Skip to content

Commit

Permalink
feat: enable attributes for Doctrine (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Sep 30, 2021
1 parent ee29cfe commit 04b0b30
Show file tree
Hide file tree
Showing 12 changed files with 1,338 additions and 1,265 deletions.
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN apk add --no-cache \
# see https://github.com/docker-library/php/issues/240#issuecomment-763112749
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so

ARG APCU_VERSION=5.1.19
ARG APCU_VERSION=5.1.20
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
Expand Down
1,231 changes: 575 additions & 656 deletions api/composer.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion api/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ doctrine:
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
3 changes: 0 additions & 3 deletions api/config/packages/prod/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
Expand Down
5 changes: 4 additions & 1 deletion api/config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
security:
# https://symfony.com/doc/current/security/experimental_authenticators.html
# https://symfony.com/doc/current/security/authenticator_manager.html
enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#c-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
users_in_memory: { memory: null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,23 @@
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200828181711 extends AbstractMigration
final class Version20210930074739 extends AbstractMigration
{
public function getDescription() : string
public function getDescription(): string
{
return '';
}

public function up(Schema $schema) : void
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SEQUENCE greeting_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE greeting (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
}

public function down(Schema $schema) : void
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE greeting_id_seq CASCADE');
$this->addSql('DROP TABLE greeting');
Expand Down
1 change: 1 addition & 0 deletions api/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
Expand Down
13 changes: 5 additions & 8 deletions api/src/Entity/Greeting.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@

/**
* This is a dummy entity. Remove it!
*
* @ORM\Entity
*/
#[ApiResource(mercure: true)]
#[ORM\Entity]
class Greeting
{
/**
* The entity ID
*
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
private ?int $id = null;

/**
* A nice person
*
* @ORM\Column
*/
#[ORM\Column]
#[Assert\NotBlank]
public string $name = '';

Expand Down
Loading

0 comments on commit 04b0b30

Please sign in to comment.