Browse Source

ProductFamilyStore : ajout getOneByTitle()

develop
Guillaume Bourgeois 1 year ago
parent
commit
6d69708fa7
2 changed files with 10 additions and 0 deletions
  1. +4
    -0
      Repository/Product/ProductFamilyRepositoryQuery.php
  2. +6
    -0
      Repository/Product/ProductFamilyStore.php

+ 4
- 0
Repository/Product/ProductFamilyRepositoryQuery.php View File

@@ -201,4 +201,8 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery
return $this;
}

public function filterByTitle(string $title): self
{
return $this->andWhere('.title LIKE :title')->setParameter('title', $title);
}
}

+ 6
- 0
Repository/Product/ProductFamilyStore.php View File

@@ -361,4 +361,10 @@ class ProductFamilyStore extends AbstractStore
return $productFamiliesToReturn;
}

public function getOneByTitle(string $title): ?ProductFamilyInterface
{
$query = $this->createDefaultQuery();
$query->filterByTitle($title);
return $query->findOne();
}
}

Loading…
Cancel
Save