Hallo zusammen,
ich habe für ein Plugin folgendes Model erstellt:
<?php
namespace TestMenu\Models;
use Doctrine\ORM\Mapping as ORM;
use Shopware\Components\Model\ModelEntity;
/**
* @ORM\Entity(repositoryClass="Repository")
* @ORM\Table(name="s_categories")
*/
class Location extends ModelEntity
{
/**
* @var integer $id
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
public function getId()
{
return $this->id;
}
/**
* Name of the category
*
* @var string $description
*
* @ORM\Column(name="description", type="string", nullable=false)
*/
private $description;
/**
* Returns the name of the supplier
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
}
Über die Repository führe ich dann die Abfrage wie folgt aus:
<?php
namespace TestMenu\Models;
use Shopware\Components\Model\ModelRepository;
class Repository extends ModelRepository
{
public function getLocationQuery()
{
$builder = $this->getLocationQueryBuilder();
return $builder->getQuery();
}
public function getLocationQueryBuilder()
{
$builder = $this->getEntityManager()->createQueryBuilder()
->select(['location.id', 'location.description'])
->from(Location::class, 'location');
return $builder;
}
}
Soweit so gut!
Leider bekomme ich für die Abfrage keine Verknüpfung zu einem speziellen Kategorie-Attribute (s_categories_attributes > attribute3) hin.
Kann mir bitte jemand von euch auf die Sprünge helfen?
Vielen Dank und beste Grüße
Michael