-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method findTypeForMigration to ProductAttributeRepository
- Loading branch information
Showing
5 changed files
with
89 additions
and
1 deletion.
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
47 changes: 47 additions & 0 deletions
47
src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductAttributeRepository.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,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; | ||
|
||
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; | ||
use Sylius\Component\Core\Repository\ProductAttributeRepositoryInterface; | ||
|
||
class ProductAttributeRepository extends EntityRepository implements ProductAttributeRepositoryInterface | ||
{ | ||
/** | ||
* @param string $type | ||
* | ||
* @return array | ||
*/ | ||
public function findByTypeForMigration(string $type): array | ||
{ | ||
return $this | ||
->createQueryBuilder('o') | ||
->select([ | ||
'o.id', | ||
'o.code', | ||
'o.type', | ||
'o.storageType', | ||
'o.configuration', | ||
'o.createdAt', | ||
'o.updatedAt', | ||
'o.position' | ||
]) | ||
->where('o.type = :type') | ||
->setParameter('type', $type) | ||
->getQuery() | ||
->getResult() | ||
; | ||
} | ||
|
||
} |
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
9 changes: 9 additions & 0 deletions
9
src/Sylius/Bundle/CoreBundle/Resources/config/app/sylius/sylius_attribute.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file is part of the Sylius package. | ||
# (c) Paweł Jędrzejewski | ||
|
||
sylius_attribute: | ||
resources: | ||
product: | ||
attribute: | ||
classes: | ||
repository: Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductAttributeRepository |
31 changes: 31 additions & 0 deletions
31
src/Sylius/Component/Core/Repository/ProductAttributeRepositoryInterface.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 | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Component\Core\Repository; | ||
|
||
use Sylius\Component\Core\Model\ProductTaxonInterface; | ||
use Sylius\Component\Resource\Repository\RepositoryInterface; | ||
|
||
interface ProductAttributeRepositoryInterface extends RepositoryInterface | ||
{ | ||
/** | ||
* This method is required by Sylius Migration's 20171003103916. | ||
* It avoids error in future migrations for ProductAttributes. | ||
* This method MUST request only existing columns when it's called. | ||
* | ||
* @param string $type | ||
* | ||
* @return array | ||
*/ | ||
public function findByTypeForMigration(string $type): array; | ||
} |