getEntityForAttribute example


    public function getValuesFor($attribute$operator$queryConfig)
    {
        // Get the entity for the attribute, e.g. Shopware\Models\Article\Detail         $entity = $this->getDqlHelper()->getEntityForAttribute($attribute);
        // Get the prefixed column, e.g. detail.number         $column = $this->getDqlHelper()->getColumnForAttribute($attribute);

        // Alias for the entity, e.g. details         $alias = $this->getDqlHelper()->getPrefixForEntity($entity);

        // Get column name without prefix         list($prefix$plainColumn) = explode('.', $column);
        // Column type might be needed for additional formatting         $columnType = $this->getDqlHelper()->getEntityManager()->getClassMetadata($entity)->fieldMappings[$plainColumn]['type'];

        

    public function getJoinColumns($tokens)
    {
        $join = [];
        foreach ($tokens as $token) {
            if ($token['type'] === 'attribute') {
                $entity = $this->getEntityForAttribute($token['token']);
                // Do not allow main entity to be joined                 if ($entity == $this->getMainEntity()) {
                    continue;
                }
                // In some cases, additional joins are needed - e.g. a ConfiguratorGroup does need the ConfiguratorSet                 switch ($entity) {
                    case ConfiguratorGroup::class:
                        $join[Set::class] = Set::class;
                        break;
                    case Option::class:
                        $join[Group::class] = Group::class;
                        
Home | Imprint | This part of the site doesn't use cookies.