-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
236 changed files
with
6,765 additions
and
1,542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 0 additions & 162 deletions
162
src/Marello/Bundle/CatalogBundle/EventListener/Datagrid/CategoriesDatagridListener.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Marello/Bundle/CatalogBundle/Migrations/Schema/v1_2/MarelloCatalogBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\CatalogBundle\Migrations\Schema\v1_2; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD.TooManyMethods) | ||
*/ | ||
class MarelloCatalogBundle implements Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$this->changeMarelloCatalogCategoryUniqueIndex($schema); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
protected function changeMarelloCatalogCategoryUniqueIndex(Schema $schema) | ||
{ | ||
$table = $schema->getTable('marello_catalog_category'); | ||
$table->dropIndex('marello_catalog_category_codeidx'); | ||
$table->addUniqueIndex(['code', 'organization_id'], 'marello_catalog_category_codeorgidx'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Marello/Bundle/CatalogBundle/Resources/config/validation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
src/Marello/Bundle/CatalogBundle/Resources/views/Datagrid/Property/categories.html.twig
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
src/Marello/Bundle/CatalogBundle/Twig/CategoryExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\CatalogBundle\Twig; | ||
|
||
use Doctrine\Bundle\DoctrineBundle\Registry; | ||
use Marello\Bundle\CatalogBundle\Entity\Category; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
|
||
class CategoryExtension extends AbstractExtension | ||
{ | ||
const NAME = 'marello_category'; | ||
|
||
/** | ||
* @var Registry | ||
*/ | ||
private $doctrine; | ||
|
||
/** | ||
* @param Registry $doctrine | ||
*/ | ||
public function __construct(Registry $doctrine) | ||
{ | ||
$this->doctrine = $doctrine; | ||
} | ||
|
||
/** | ||
* Returns the name of the extension. | ||
* | ||
* @return string The extension name | ||
*/ | ||
public function getName() | ||
{ | ||
return self::NAME; | ||
} | ||
|
||
/** | ||
* Returns a list of functions to add to the existing list. | ||
* | ||
* @return array An array of functions | ||
*/ | ||
public function getFunctions() | ||
{ | ||
return [ | ||
new TwigFunction( | ||
'marello_get_category_name_by_code', | ||
[$this, 'getCategoryNameByCode'] | ||
) | ||
]; | ||
} | ||
|
||
/** | ||
* @param string $code | ||
* @return string | ||
*/ | ||
public function getCategoryNameByCode($code) | ||
{ | ||
$category = $this->doctrine | ||
->getManagerForClass(Category::class) | ||
->getRepository(Category::class) | ||
->findOneBy(['code' => $code]); | ||
if ($category) { | ||
return $category->getName(); | ||
} | ||
|
||
return $code; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.