protected function getMetaModelFromModel(ModelInterface $model)
    {
        if (!(($model->getProviderName() == 'tl_metamodel_dca_sortgroup') && $model->getProperty('pid'))) {
            throw new DcGeneralInvalidArgumentException(
                sprintf(
                    'Model must originate from tl_metamodel_dca_sortgroup and be saved, this one originates from %s ' .
                    'and has pid %s',
                    $model->getProviderName(),
                    $model->getProperty('pid')
                )
            );
        }

        $metaModelId = $this->connection->createQueryBuilder()
            ->select('pid')
            ->from('tl_metamodel_dca')
            ->where('id=:id')
            ->setParameter('id', $model->getProperty('pid'))
            ->execute()
            ->fetchColumn();

        $tableName = $this->factory->translateIdToMetaModelName($metaModelId);

        return $this->factory->getMetaModel($tableName);
    }
protected function getMetaModelFromModel(ModelInterface $model)
    {
        if (!(($model->getProviderName() == 'tl_metamodel_dca_sortgroup') && $model->getProperty('pid'))) {
            throw new DcGeneralInvalidArgumentException(
                sprintf(
                    'Model must originate from tl_metamodel_dca_sortgroup and be saved, this one originates from %s ' .
                    'and has pid %s',
                    $model->getProviderName(),
                    $model->getProperty('pid')
                )
            );
        }

        $metaModelId = $this->connection->createQueryBuilder()
            ->select('pid')
            ->from('tl_metamodel_dca')
            ->where('id=:id')
            ->setParameter('id', $model->getProperty('pid'))
            ->execute()
            ->fetchColumn();

        $tableName = $this->factory->translateIdToMetaModelName($metaModelId);

        return $this->factory->getMetaModel($tableName);
    }
protected function getMetaModelFromModel ( ModelInterface $ model ) { if ( ! ( ( $ model -> getProviderName ( ) == 'tl_metamodel_dca_sortgroup' ) && $ model -> getProperty ( 'pid' ) ) ) { throw new DcGeneralInvalidArgumentException ( sprintf ( 'Model must originate from tl_metamodel_dca_sortgroup and be saved, this one originates from %s ' . 'and has pid %s' , $ model -> getProviderName ( ) , $ model -> getProperty ( 'pid' ) ) ) ; } $ metaModelId = $ this -> connection -> createQueryBuilder ( ) -> select ( 'pid' ) -> from ( 'tl_metamodel_dca' ) -> where ( 'id=:id' ) -> setParameter ( 'id' , $ model -> getProperty ( 'pid' ) ) -> execute ( ) -> fetchColumn ( ) ; $ tableName = $ this -> factory -> translateIdToMetaModelName ( $ metaModelId ) ; return $ this -> factory -> getMetaModel ( $ tableName ) ; }
Retrieve the MetaModel the given model is attached to.

@param ModelInterface $model The input screen model for which to retrieve the MetaModel.

@return IMetaModel

@throws DcGeneralInvalidArgumentException When an invalid model has been passed or the model does not have an id.
Retrieve the MetaModel the given model is attached to .