Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #114 from cultuurnet/bugfix/fix-missing-code
Browse files Browse the repository at this point in the history
Fix missing code
  • Loading branch information
jdrieghe committed Jun 3, 2020
2 parents 4a8d534 + deb6482 commit 803af36
Show file tree
Hide file tree
Showing 40 changed files with 2,159 additions and 47 deletions.
20 changes: 4 additions & 16 deletions app/Migrations/Version20170512114208.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace CultuurNet\UDB3\CdbXmlService\Migrations;

use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine\SchemaConfigurator;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
Expand All @@ -12,28 +11,17 @@
*/
class Version20170512114208 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->getLabelsRelationsTable($schema)
->addColumn(SchemaConfigurator::IMPORTED, Type::BOOLEAN)
$schema->getTable('labels_relations')
->addColumn('imported', Type::BOOLEAN)
->setNotnull(true)
->setDefault(false);
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->getLabelsRelationsTable($schema)
->dropColumn(SchemaConfigurator::IMPORTED);
}

private function getLabelsRelationsTable(Schema $schema)
{
return $schema->getTable('labels_relations');
$schema->getTable('labels_relations')
->dropColumn('imported');
}
}
20 changes: 10 additions & 10 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use CultuurNet\UDB3\CdbXmlService\DatabaseSchemaInstaller;
use CultuurNet\UDB3\CdbXmlService\EventBusCdbXmlPublisher;
use CultuurNet\UDB3\CdbXmlService\EventBusRelay;
use CultuurNet\UDB3\CdbXmlService\Iri\CallableIriGenerator;
use CultuurNet\UDB3\CdbXmlService\ReadModel\CdbXmlDateFormatter;
use CultuurNet\UDB3\CdbXmlService\ReadModel\FlandersRegionOfferCdbXmlProjector;
use CultuurNet\UDB3\CdbXmlService\ReadModel\FlandersRegionOrganizerCdbXmlProjector;
Expand All @@ -35,8 +36,7 @@
use CultuurNet\UDB3\CdbXmlService\ReadModel\RelationsToCdbXmlProjector;
use CultuurNet\UDB3\CdbXmlService\ReadModel\Repository\BroadcastingDocumentRepositoryDecorator;
use CultuurNet\UDB3\CdbXmlService\ReadModel\Repository\CacheDocumentRepository;
use CultuurNet\UDB3\Iri\CallableIriGenerator;
use CultuurNet\UDB3\Label\LabelEventRelationTypeResolver;
use CultuurNet\UDB3\CdbXmlService\Relations\Label\LabelEventRelationTypeResolver;
use CultuurNet\UDB3\SimpleEventBus as UDB3SimpleEventBus;
use DerAlex\Silex\YamlConfigServiceProvider;
use Monolog\Handler\StreamHandler;
Expand Down Expand Up @@ -611,23 +611,23 @@ function (Application $app) {

$app['event_relations_repository'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Event\ReadModel\Relations\Doctrine\DBALRepository(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Event\Doctrine\DBALRepository(
$app['dbal_connection']
);
}
);

$app['place_relations_repository'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Place\ReadModel\Relations\Doctrine\DBALRepository(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Place\Doctrine\DBALRepository(
$app['dbal_connection']
);
}
);

$app['labels_relations_repository'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine\DBALWriteRepository(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Label\Repository\Doctrine\DBALWriteRepository(
$app['dbal_connection'],
new StringLiteral('labels_relations')
);
Expand All @@ -636,7 +636,7 @@ function ($app) {

$app[OFFER_LABEL_RELATION_REPOSITORY] = $app->share(
function (Application $app) {
return new \CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine\DBALReadRepository(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Label\Repository\Doctrine\DBALReadRepository(
$app['dbal_connection'],
new StringLiteral('labels_relations')
);
Expand All @@ -645,7 +645,7 @@ function (Application $app) {

$app['event_relations_projector'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Event\ReadModel\Relations\Projector(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Event\Projector(
$app['event_relations_repository'],
$app['event_cdbid_extractor']
);
Expand All @@ -654,15 +654,15 @@ function ($app) {

$app['place_relations_projector'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Place\ReadModel\Relations\Projector(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Place\Projector(
$app['place_relations_repository']
);
}
);

$app['labels_relations_projector'] = $app->share(
function ($app) {
return new \CultuurNet\UDB3\Label\ReadModels\Relations\Projector(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Label\Projector(
$app['labels_relations_repository'],
$app[OFFER_LABEL_RELATION_REPOSITORY],
new LabelEventRelationTypeResolver()
Expand All @@ -678,7 +678,7 @@ function (Application $app) {

$app['labels_relations_schema'] = $app->share(
function (Application $app) {
return new \CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine\SchemaConfigurator(
return new \CultuurNet\UDB3\CdbXmlService\Relations\Label\Repository\Doctrine\SchemaConfigurator(
new StringLiteral('labels_relations')
);
}
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/DatabaseSchemaInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CultuurNet\UDB3\CdbXmlService;

use CultuurNet\UDB3\Doctrine\DBAL\SchemaConfiguratorInterface;
use CultuurNet\UDB3\CdbXmlService\Doctrine\DBAL\SchemaConfiguratorInterface;
use Silex\Application;

class DatabaseSchemaInstaller implements DatabaseSchemaInstallerInterface
Expand Down
10 changes: 10 additions & 0 deletions src/Doctrine/DBAL/SchemaConfiguratorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace CultuurNet\UDB3\CdbXmlService\Doctrine\DBAL;

use Doctrine\DBAL\Schema\AbstractSchemaManager;

interface SchemaConfiguratorInterface
{
public function configure(AbstractSchemaManager $schemaManager);
}
37 changes: 37 additions & 0 deletions src/Iri/CallableIriGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace CultuurNet\UDB3\CdbXmlService\Iri;

/**
* A IRI generator that delegates its duties to a PHP callable.
*
* @link http://php.net/manual/en/language.types.callable.php
*/
class CallableIriGenerator implements IriGeneratorInterface
{
/**
* @var callable
*/
protected $callback;

/**
* Constructs a new CallableIriGenerator.
*
* @param callable $callback
* The callback to delegate the generation of IRIs to. The callable needs
* to take one string argument, the item to generate the IRI for.
*/
public function __construct(callable $callback)
{
$this->callback = $callback;
}

/**
* {@inheritdoc}
*/
public function iri($item)
{
$callback = $this->callback;
return $callback($item);
}
}
22 changes: 22 additions & 0 deletions src/Iri/IriGeneratorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace CultuurNet\UDB3\CdbXmlService\Iri;

/**
* Interface for IRI generators.
*
* @link http://en.wikipedia.org/wiki/Dereferenceable_Uniform_Resource_Identifier
*/
interface IriGeneratorInterface
{
/**
* Generates a IRI for a specific item.
*
* @param string $item
* A string uniquely identifying an item.
*
* @return string
* The IRI for the specified item.
*/
public function iri($item);
}
2 changes: 1 addition & 1 deletion src/ReadModel/LabelToItemCdbxmlProjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use CultuurNet\UDB3\Cdb\EventItemFactory;
use CultuurNet\UDB3\CdbXmlService\CdbXmlDocument\CdbXmlDocumentFactoryInterface;
use CultuurNet\UDB3\CdbXmlService\ReadModel\Repository\DocumentRepositoryInterface;
use CultuurNet\UDB3\CdbXmlService\Relations\Label\Repository\ReadRepositoryInterface;
use CultuurNet\UDB3\Label;
use CultuurNet\UDB3\Label\Events\AbstractEvent;
use CultuurNet\UDB3\Label\Events\MadeInvisible;
use CultuurNet\UDB3\Label\Events\MadeVisible;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\ReadRepositoryInterface;
use CultuurNet\UDB3\Label\ValueObjects\RelationType;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
Expand Down
2 changes: 1 addition & 1 deletion src/ReadModel/OfferProjectedToCdbXmlEventFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use CultuurNet\UDB3\CdbXmlService\Events\EventProjectedToCdbXml;
use CultuurNet\UDB3\CdbXmlService\Events\PlaceProjectedToCdbXml;
use CultuurNet\UDB3\CdbXmlService\CdbXmlDocument\CdbXmlDocument;
use CultuurNet\UDB3\CdbXmlService\Iri\IriGeneratorInterface;
use CultuurNet\UDB3\CdbXmlService\ReadModel\Repository\DocumentEventFactoryInterface;
use CultuurNet\UDB3\Iri\IriGeneratorInterface;
use CultuurNet\UDB3\Offer\Events\AbstractEventWithIri;

class OfferProjectedToCdbXmlEventFactory implements DocumentEventFactoryInterface
Expand Down
8 changes: 2 additions & 6 deletions src/ReadModel/OfferToCdbXmlProjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
use CultuurNet\UDB3\CdbXmlService\CultureFeed\CategorySpecification\Not;
use CultuurNet\UDB3\CdbXmlService\CultureFeed\CategorySpecification\Type;
use CultuurNet\UDB3\CdbXmlService\ReadModel\Repository\DocumentRepositoryInterface;
use CultuurNet\UDB3\CdbXmlService\ValueObjects\Offer\AvailableTo;
use CultuurNet\UDB3\ContactPoint;
use CultuurNet\UDB3\CulturefeedSlugger;
use CultuurNet\UDB3\EntityNotFoundException;
use CultuurNet\UDB3\Event\Events\AudienceUpdated;
use CultuurNet\UDB3\Event\Events\BookingInfoUpdated as EventBookingInfoUpdated;
use CultuurNet\UDB3\Event\Events\CalendarUpdated as EventCalendarUpdated;
Expand Down Expand Up @@ -79,6 +79,7 @@
use CultuurNet\UDB3\Offer\Events\AbstractFacilitiesUpdated;
use CultuurNet\UDB3\Offer\Events\AbstractThemeUpdated;
use CultuurNet\UDB3\Offer\Events\AbstractTypeUpdated;
use CultuurNet\UDB3\Offer\WorkflowStatus;
use CultuurNet\UDB3\Place\Events\ThemeUpdated as PlaceThemeUpdated;
use CultuurNet\UDB3\Event\Events\TitleTranslated as EventTitleTranslated;
use CultuurNet\UDB3\Event\Events\OrganizerDeleted as EventOrganizerDeleted;
Expand All @@ -92,7 +93,6 @@
use CultuurNet\UDB3\Event\ValueObjects\AudienceType;
use CultuurNet\UDB3\Facility;
use CultuurNet\UDB3\Media\Image;
use CultuurNet\UDB3\Offer\AvailableTo;
use CultuurNet\UDB3\Offer\Events\AbstractBookingInfoUpdated;
use CultuurNet\UDB3\Offer\Events\AbstractContactPointUpdated;
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionTranslated;
Expand All @@ -113,7 +113,6 @@
use CultuurNet\UDB3\Offer\Events\Image\AbstractMainImageSelected;
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractApproved;
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractPublished;
use CultuurNet\UDB3\Offer\WorkflowStatus;
use CultuurNet\UDB3\Place\Events\TitleUpdated as PlaceTitleUpdated;
use CultuurNet\UDB3\Event\Events\TitleUpdated as EventTitleUpdated;
use CultuurNet\UDB3\Place\Events\AddressUpdated;
Expand Down Expand Up @@ -143,7 +142,6 @@
use CultuurNet\UDB3\SluggerInterface;
use CultuurNet\UDB3\StringFilter\StringFilterInterface;
use CultuurNet\UDB3\Theme;
use DateTime;
use DateTimeInterface;
use League\Uri\Modifiers\AbstractUriModifier;
use League\Uri\Modifiers\Normalize;
Expand All @@ -153,7 +151,6 @@
use Psr\Log\NullLogger;
use RuntimeException;
use ValueObjects\Identity\UUID;
use ValueObjects\StringLiteral\StringLiteral;
use Rhumsaa\Uuid\Uuid as BaseUuid;

/**
Expand Down Expand Up @@ -1827,7 +1824,6 @@ public function setWorkflowStatus(AbstractEvent $event, Metadata $metadata, Work
*
* @param LocationId $locationId
* @param CultureFeed_Cdb_Item_Event $cdbEvent
* @throws EntityNotFoundException
*/
private function setLocation(LocationId $locationId, CultureFeed_Cdb_Item_Event $cdbEvent)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ReadModel/Repository/OfferRelationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace CultuurNet\UDB3\CdbXmlService\ReadModel\Repository;

use CultuurNet\UDB3\Event\ReadModel\Relations\RepositoryInterface as EventRelationsRepositoryInterface;
use CultuurNet\UDB3\Place\ReadModel\Relations\RepositoryInterface as PlaceRelationsRepositoryInterface;
use CultuurNet\UDB3\CdbXmlService\Relations\Event\RepositoryInterface as EventRelationsRepositoryInterface;
use CultuurNet\UDB3\CdbXmlService\Relations\Place\RepositoryInterface as PlaceRelationsRepositoryInterface;

class OfferRelationsService implements OfferRelationsServiceInterface
{
Expand Down

0 comments on commit 803af36

Please sign in to comment.