src/MetaModel.php
public function delete(IItem $objItem)
    {
        $arrIds = array($objItem->get('id'));
        // Determine if the model is a variant base and if so, fetch the variants additionally.
        if ($objItem->isVariantBase()) {
            $objVariants = $objItem->getVariants(new Filter($this));
            foreach ($objVariants as $objVariant) {
                /** @var IItem $objVariant */
                $arrIds[] = $objVariant->get('id');
            }
        }

        // Complex attributes shall delete their values first.
        foreach ($this->getAttributes() as $objAttribute) {
            if ($this->isComplexAttribute($objAttribute)) {
                /** @var IComplex $objAttribute */
                $objAttribute->unsetDataFor($arrIds);
            }
        }
        // Now make the real row disappear.
        $builder = $this->getConnection()->createQueryBuilder();

        $builder
            ->delete($this->getTableName())
            ->where($builder->expr()->in('id', ':ids'))
            ->setParameter('ids', $arrIds, Connection::PARAM_STR_ARRAY)
            ->execute();
    }
public function delete(IItem $objItem)
    {
        $arrIds = array($objItem->get('id'));
        // Determine if the model is a variant base and if so, fetch the variants additionally.
        if ($objItem->isVariantBase()) {
            $objVariants = $objItem->getVariants(new Filter($this));
            foreach ($objVariants as $objVariant) {
                /** @var IItem $objVariant */
                $arrIds[] = $objVariant->get('id');
            }
        }

        // Complex attributes shall delete their values first.
        foreach ($this->getAttributes() as $objAttribute) {
            if ($this->isComplexAttribute($objAttribute)) {
                /** @var IComplex $objAttribute */
                $objAttribute->unsetDataFor($arrIds);
            }
        }
        // Now make the real row disappear.
        $builder = $this->getConnection()->createQueryBuilder();

        $builder
            ->delete($this->getTableName())
            ->where($builder->expr()->in('id', ':ids'))
            ->setParameter('ids', $arrIds, Connection::PARAM_STR_ARRAY)
            ->execute();
    }
public function delete ( IItem $ objItem ) { $ arrIds = array ( $ objItem -> get ( 'id' ) ) ; // Determine if the model is a variant base and if so, fetch the variants additionally. if ( $ objItem -> isVariantBase ( ) ) { $ objVariants = $ objItem -> getVariants ( new Filter ( $ this ) ) ; foreach ( $ objVariants as $ objVariant ) { /** @var IItem $objVariant */ $ arrIds [ ] = $ objVariant -> get ( 'id' ) ; } } // Complex attributes shall delete their values first. foreach ( $ this -> getAttributes ( ) as $ objAttribute ) { if ( $ this -> isComplexAttribute ( $ objAttribute ) ) { /** @var IComplex $objAttribute */ $ objAttribute -> unsetDataFor ( $ arrIds ) ; } } // Now make the real row disappear. $ builder = $ this -> getConnection ( ) -> createQueryBuilder ( ) ; $ builder -> delete ( $ this -> getTableName ( ) ) -> where ( $ builder -> expr ( ) -> in ( 'id' , ':ids' ) ) -> setParameter ( 'ids' , $ arrIds , Connection :: PARAM_STR_ARRAY ) -> execute ( ) ; }
{@inheritdoc}
{