Skip to content

Commit

Permalink
Merge pull request #1 from dpfaffenbauer/dependant-bundles
Browse files Browse the repository at this point in the history
Use DependantBundle that will be introduced in beta-1 from coreshop-resource-bundle
  • Loading branch information
dpfaffenbauer committed Apr 11, 2018
2 parents f30a919 + acfafa2 commit 31a7d24
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 59 deletions.
24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,8 @@ ObjectIndex helps you create rich indices and query your Object-Data using re-us
## Getting started
* Since Object-Index depends on CoreShops IndexBundle, and the IndexBundle only exists in DEV yet, you need to set your "minimum-stability" to "dev" in your composer.json
* Install via composer ```composer require dpfaffenbauer/object-index dev-master```
* Load needed Bundles:
```php
<?php

// app/AppKernel.php
public function registerBundlesToCollection(BundleCollection $collection)
{
$collection->addBundles(array(
new \JMS\SerializerBundle\JMSSerializerBundle(),

new \CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle(),
new \CoreShop\Bundle\IndexBundle\CoreShopIndexBundle(),

new \FOS\RestBundle\FOSRestBundle(),
new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
), 120);
}
```
* Open Extension Manager in Pimcore and enable/install Plugin
* It sometimes happens to me that assets are not getting installed right from pimcore, therefore run ```bin/console assets:install --symlink```
* Install via Pimcore Extension Manager
* Enable via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:enable ObjectIndexBundle```
* Install via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:install ObjectIndexBundle```
* After Installation within Pimcore Extension Manager, you have to reload Pimcore
* You now have a new Menu Entry for Indexes and Filters

Expand Down
17 changes: 9 additions & 8 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,42 @@
use Doctrine\DBAL\Migrations\Version;
use Doctrine\DBAL\Schema\Schema;
use Pimcore\Extension\Bundle\Installer\MigrationInstaller;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Pimcore\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;

class Installer extends MigrationInstaller
{
/**
* {@inheritdoc}
*
*/
protected function beforeInstallMigration()
{
$kernel = \Pimcore::getKernel();
$application = new Application($kernel);
$application->setAutoExit(false);
$options = ['command' => 'doctrine:schema:update'];
$options = array_merge($options, ['--no-interaction' => true, '--force' => true]);
$options = ['command' => 'coreshop:resources:install'];
$options = array_merge($options, ['--no-interaction' => true, '--application-name object_index']);
$application->run(new ArrayInput($options));

$options = ['command' => 'cache:clear'];
$options = array_merge($options, ['--no-warmup']);
$options = ['command' => 'doctrine:schema:update'];
$options = array_merge($options, ['--no-interaction' => true, '--force' => true]);
$application->run(new ArrayInput($options));
}


/**
* {@inheritdoc}
*/
public function migrateInstall(Schema $schema, Version $version)
{
//Nothing to do here

}

/**
* {@inheritdoc}
*/
public function migrateUninstall(Schema $schema, Version $version)
{
//Nothing to do here

}
}
64 changes: 35 additions & 29 deletions src/ObjectIndexBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,57 @@

namespace ObjectIndexBundle;

use ObjectIndexBundle\Installer\PimcoreInstaller;
use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
use CoreShop\Bundle\IndexBundle\CoreShopIndexBundle;
use CoreShop\Bundle\ResourceBundle\AbstractResourceBundle;
use CoreShop\Bundle\ResourceBundle\ComposerPackageBundleInterface;
use CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle;
use Pimcore\Extension\Bundle\PimcoreBundleInterface;
use Pimcore\HttpKernel\BundleCollection\BundleCollection;

class ObjectIndexBundle extends AbstractPimcoreBundle
class ObjectIndexBundle extends AbstractResourceBundle implements PimcoreBundleInterface, ComposerPackageBundleInterface
{
/**
* {@inheritdoc}
*/
public function getNiceName()
public static function registerDependentBundles(BundleCollection $collection)
{
return 'Object Index';
parent::registerDependentBundles($collection);

$collection->addBundle(new CoreShopIndexBundle(), 2400);
}

/**
* {@inheritdoc}
*/
public function getDescription()
public function getPackageName()
{
return 'ObjectIndex lets you create Indexes and Filters of Objects';
return 'dpfaffenbauer/pimcore-object-index';
}

/**
* {@inheritdoc}
*/
public function getSupportedDrivers()
{
return [
CoreShopResourceBundle::DRIVER_PIMCORE,
];
}

/**
* {@inheritdoc}
*/
public function getVersion()
public function getNiceName()
{
return '1.0.0';
return 'Object Index';
}

/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'ObjectIndex lets you create Indexes and Filters of Objects';
}

/**
Expand All @@ -52,33 +76,15 @@ public function getAdminIframePath()
*/
public function getJsPaths()
{
$jsFiles = [];

if ($this->container->hasParameter('coreshop.application.pimcore.admin.js')) {
$jsFiles = array_merge(
$this->container->get('coreshop.resource_loader')->loadResources($this->container->getParameter('coreshop.application.pimcore.admin.js')),
$this->container->get('coreshop.resource_loader')->loadResources($this->container->getParameter('object_index.pimcore.admin.js'))
);
}

return $jsFiles;
return [];
}

/**
* {@inheritdoc}
*/
public function getCssPaths()
{
$cssFiles = [];

if ($this->container->hasParameter('coreshop.application.pimcore.admin.css')) {
$cssFiles = array_merge(
$this->container->get('coreshop.resource_loader')->loadResources($this->container->getParameter('coreshop.application.pimcore.admin.css')),
$this->container->get('coreshop.resource_loader')->loadResources($this->container->getParameter('object_index.pimcore.admin.css'))
);
}

return $cssFiles;
return [];
}

/**
Expand Down

0 comments on commit 31a7d24

Please sign in to comment.