Skip to content

Commit

Permalink
Fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Thompson committed Feb 15, 2021
1 parent 92d6bfb commit f4f5b14
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 9 deletions.
5 changes: 5 additions & 0 deletions docs/en/01.prologue/02.change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Features that are deprecated will generally be removed in the next `minor` updat

## Releases

### [1.8.21] - 2021-02-15
### Fixed
- Fixed autoloading issue with installer(s) not reloading generated entry models.
- Fixed issue where streams try to clear versionable history after deletion.

### [1.8.20] - 2021-01-25
### Fixed
- Fixed issue with PHP compatibility in `src/View/ViewIncludes.php`.
Expand Down
9 changes: 6 additions & 3 deletions src/Addon/Extension/Command/InstallExtension.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php namespace Anomaly\Streams\Platform\Addon\Extension\Command;

use Anomaly\Streams\Platform\Console\Kernel;
use Anomaly\Streams\Platform\Addon\AddonManager;
use Anomaly\Streams\Platform\Addon\Extension\Contract\ExtensionRepositoryInterface;
use Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasInstalled;
use Anomaly\Streams\Platform\Addon\Extension\Extension;
use Anomaly\Streams\Platform\Console\Kernel;
use Anomaly\Streams\Platform\Entry\Command\AutoloadEntryModels;
use Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasInstalled;
use Anomaly\Streams\Platform\Addon\Extension\Contract\ExtensionRepositoryInterface;

/**
* Class InstallExtension
Expand Down Expand Up @@ -66,6 +67,8 @@ public function handle(

$extensions->install($this->extension);

dispatch_now(new AutoloadEntryModels);

$manager->register();

if ($this->seed) {
Expand Down
3 changes: 3 additions & 0 deletions src/Addon/Module/Command/InstallModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasInstalled;
use Anomaly\Streams\Platform\Addon\Module\Module;
use Anomaly\Streams\Platform\Console\Kernel;
use Anomaly\Streams\Platform\Entry\Command\AutoloadEntryModels;

/**
* Class InstallModule
Expand Down Expand Up @@ -64,6 +65,8 @@ public function handle(

$console->call('migrate', $options);

dispatch_now(new AutoloadEntryModels);

$modules->install($this->module);

$manager->register();
Expand Down
4 changes: 2 additions & 2 deletions src/Addon/Module/ModuleManager.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace Anomaly\Streams\Platform\Addon\Module;

use Anomaly\Streams\Platform\Addon\Module\Command\DisableModule;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Anomaly\Streams\Platform\Addon\Module\Command\EnableModule;
use Anomaly\Streams\Platform\Addon\Module\Command\DisableModule;
use Anomaly\Streams\Platform\Addon\Module\Command\InstallModule;
use Anomaly\Streams\Platform\Addon\Module\Command\MigrateModule;
use Anomaly\Streams\Platform\Addon\Module\Command\UninstallModule;
use Illuminate\Foundation\Bus\DispatchesJobs;

/**
* Class ModuleManager
Expand Down
41 changes: 41 additions & 0 deletions src/Stream/Event/StreamIsDeleting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php namespace Anomaly\Streams\Platform\Stream\Event;

use Anomaly\Streams\Platform\Stream\Contract\StreamInterface;

/**
* Class StreamIsDeleting
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
*/
class StreamIsDeleting
{

/**
* The stream interface.
*
* @var \Anomaly\Streams\Platform\Stream\Contract\StreamInterface
*/
protected $stream;

/**
* Create a new StreamIsDeleting instance.
*
* @param StreamInterface $stream
*/
public function __construct(StreamInterface $stream)
{
$this->stream = $stream;
}

/**
* Get the stream interface.
*
* @return StreamInterface
*/
public function getStream()
{
return $this->stream;
}
}
11 changes: 11 additions & 0 deletions src/Stream/StreamObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Anomaly\Streams\Platform\Stream\Command\DropStreamsEntryTable;
use Anomaly\Streams\Platform\Stream\Command\RenameStreamsEntryTable;
use Anomaly\Streams\Platform\Stream\Contract\StreamInterface;
use Anomaly\Streams\Platform\Stream\Event\StreamIsDeleting;
use Anomaly\Streams\Platform\Stream\Event\StreamWasCreated;
use Anomaly\Streams\Platform\Stream\Event\StreamWasDeleted;
use Anomaly\Streams\Platform\Stream\Event\StreamWasSaved;
Expand Down Expand Up @@ -91,6 +92,16 @@ public function updated(StreamInterface $model)
$this->events->dispatch(new StreamWasUpdated($model));
}

/**
* Run before a stream is deleted.
*
* @param StreamInterface $model
*/
public function deleting(StreamInterface $model)
{
$this->events->dispatch(new StreamIsDeleting($model));
}

/**
* Run after a stream has been deleted.
*
Expand Down
3 changes: 2 additions & 1 deletion src/StreamsEventProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Anomaly\Streams\Platform\Asset\Listener\AddAddonPaths as AddAddonAssetPaths;
use Anomaly\Streams\Platform\Image\Listener\AddAddonPaths as AddAddonImagePaths;
use Anomaly\Streams\Platform\Message\Listener\LoadMessageBag;
use Anomaly\Streams\Platform\Stream\Event\StreamIsDeleting;
use Anomaly\Streams\Platform\Stream\Event\StreamWasDeleted;
use Anomaly\Streams\Platform\Ui\Breadcrumb\Listener\GuessBreadcrumbs;
use Anomaly\Streams\Platform\Ui\Breadcrumb\Listener\LoadBreadcrumbs;
Expand Down Expand Up @@ -60,7 +61,7 @@ class StreamsEventProvider extends EventServiceProvider
ApplyView::class,
FilterResults::class,
],
StreamWasDeleted::class => [
StreamIsDeleting::class => [
DeleteVersionableHistory::class,
],
];
Expand Down
6 changes: 3 additions & 3 deletions src/Version/Listener/DeleteVersionableHistory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Anomaly\Streams\Platform\Version\Listener;

use Anomaly\Streams\Platform\Stream\Event\StreamWasDeleted;
use Anomaly\Streams\Platform\Stream\Event\StreamIsDeleting;
use Anomaly\Streams\Platform\Version\Contract\VersionRepositoryInterface;

/**
Expand Down Expand Up @@ -33,9 +33,9 @@ public function __construct(VersionRepositoryInterface $versions)
/**
* Handle the event.
*
* @param StreamWasDeleted $event
* @param StreamIsDeleting $event
*/
public function handle(StreamWasDeleted $event)
public function handle(StreamIsDeleting $event)
{
$stream = $event->getStream();

Expand Down

0 comments on commit f4f5b14

Please sign in to comment.