Skip to content

Commit

Permalink
Merge pull request #8 from Elastic-Suite/espp173_repository_structure
Browse files Browse the repository at this point in the history
Espp173 repository structure
  • Loading branch information
rbayet committed Jan 27, 2022
2 parents da912bb + 9235717 commit b47e8da
Show file tree
Hide file tree
Showing 12 changed files with 197 additions and 12 deletions.
5 changes: 5 additions & 0 deletions api/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Acme\GreetingsBundle\AcmeGreetingsBundle::class => ['dev' => true, 'test' => true],
# all => true is required because there is a mapping in the global config/packages/doctrine.yml.
Acme\DeclarativeGreetingsBundle\AcmeDeclarativeGreetingsBundle::class => ['all' => true],
Elasticsuite\Catalog\ElasticsuiteCatalogBundle::class => ['all' => true],
Elasticsuite\Index\ElasticsuiteIndexBundle::class => ['all' => true],
];
2 changes: 1 addition & 1 deletion api/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ api_platform:
title: Hello API Platform
version: 1.0.0
mapping:
paths: ['%kernel.project_dir%/src/']
paths: ['%kernel.project_dir%/src/App']
patch_formats:
json: ['application/merge-patch+json']
swagger:
Expand Down
25 changes: 15 additions & 10 deletions api/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ doctrine:
dir: '%kernel.project_dir%/src/App/Entity'
prefix: 'App\Entity'
alias: App
Elasticsuite:
is_bundle: false
dir: '%kernel.project_dir%/src/Elasticsuite/'
prefix: 'Elasticsuite'
alias: Elasticsuite
Acme:
is_bundle: false
dir: '%kernel.project_dir%/src/Acme/'
prefix: 'Acme'
alias: Acme
#Acme:
# is_bundle: false
# dir: '%kernel.project_dir%/src/Acme/'
# prefix: 'Acme'
# alias: Acme
# Must be the name of the bundle class.
AcmeDeclarativeGreetingsBundle:
is_bundle: true
mapping: true
# Alternative location to 'Entity' (default)
dir: 'Models'
# For manually declared bundles, the prefix MUST be set explicitely.
# And it MUST be a prefix of the entities/models classnames located in %dir%.
prefix: 'Acme\DeclarativeGreetingsBundle'
type: 'attribute'
34 changes: 34 additions & 0 deletions api/migrations/Version20220125195152.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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 Version20220125195152 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE declarative_greeting_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE declarative_greeting (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE declarative_greeting_id_seq CASCADE');
$this->addSql('DROP TABLE declarative_greeting');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Acme
* @package Acme\DeclarativeGreetingsBundle
* @author Richard Bayet <richard.bayet@smile.fr>
* @copyright 2022 Smile
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided.
* Unauthorized copying of this file, via any medium, is strictly prohibited.
*/

namespace Acme\DeclarativeGreetingsBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeDeclarativeGreetingsBundle extends Bundle
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Acme\DeclarativeGreetingsBundle\Models;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

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

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

public function getId(): ?int
{
return $this->id;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resources:
Acme\DeclarativeGreetingsBundle\Models\DeclarativeGreeting:
# Shortname used for the route: becomes '/declarative_greeting' and the plural form is applied somehow.
shortName: 'DeclarativeGreeting'
description: 'Description of declarative greetings (description)'
# IRI NOT used for internal object IDs which use the shortName (eg: '"@id"! "/declarative_greetings/1")
# BUT used for the @type property.
iri: 'Declarative Greeting'
# itemOperations: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] ???
# collectionOperations: ['GET'] ??
# subresourceOperations: []
# graphql: true
# attributes: []
# properties: []
23 changes: 23 additions & 0 deletions api/src/Acme/GreetingsBundle/AcmeGreetingsBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Acme
* @package Acme\GreetingsBundle
* @author Richard Bayet <richard.bayet@smile.fr>
* @copyright 2022 Smile
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided.
* Unauthorized copying of this file, via any medium, is strictly prohibited.
*/

namespace Acme\GreetingsBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeGreetingsBundle extends Bundle
{

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Acme\Greetings\Entity;
namespace Acme\GreetingsBundle\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
Expand Down
Empty file removed api/src/App/Entity/Greeting.php
Empty file.
23 changes: 23 additions & 0 deletions api/src/Elasticsuite/Catalog/ElasticsuiteCatalogBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Elasticsuite
* @package Elasticsuite\Catalog
* @author Richard Bayet <richard.bayet@smile.fr>
* @copyright 2022 Smile
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided.
* Unauthorized copying of this file, via any medium, is strictly prohibited.
*/

namespace Elasticsuite\Catalog;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ElasticsuiteCatalogBundle extends Bundle
{

}
23 changes: 23 additions & 0 deletions api/src/Elasticsuite/Index/ElasticsuiteIndexBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
* versions in the future.
*
* @category Elasticsuite
* @package Elasticsuite\Index
* @author Richard Bayet <richard.bayet@smile.fr>
* @copyright 2022 Smile
* @license Licensed to Smile-SA. All rights reserved. No warranty, explicit or implicit, provided.
* Unauthorized copying of this file, via any medium, is strictly prohibited.
*/

namespace Elasticsuite\Index;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ElasticsuiteIndexBundle extends Bundle
{

}

0 comments on commit b47e8da

Please sign in to comment.