public function removePolicyLimitations($policyId)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation'),
            $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation_value')
        )->from(
            $this->handler->quoteTable('ezpolicy')
        )->leftJoin(
            $this->handler->quoteTable('ezpolicy_limitation'),
            $query->expr->eq(
                $this->handler->quoteColumn('policy_id', 'ezpolicy_limitation'),
                $this->handler->quoteColumn('id', 'ezpolicy')
            )
        )->leftJoin(
            $this->handler->quoteTable('ezpolicy_limitation_value'),
            $query->expr->eq(
                $this->handler->quoteColumn('limitation_id', 'ezpolicy_limitation_value'),
                $this->handler->quoteColumn('id', 'ezpolicy_limitation')
            )
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('id', 'ezpolicy'),
                $query->bindValue($policyId, null, \PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        $limitationIdsSet = array();
        $limitationValuesSet = array();
        while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
            if ($row['ezpolicy_limitation_id'] !== null) {
                $limitationIdsSet[$row['ezpolicy_limitation_id']] = true;
            }

            if ($row['ezpolicy_limitation_value_id'] !== null) {
                $limitationValuesSet[$row['ezpolicy_limitation_value_id']] = true;
            }
        }

        if (!empty($limitationIdsSet)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('ezpolicy_limitation'))
                ->where(
                    $query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationIdsSet))
                );
            $query->prepare()->execute();
        }

        if (!empty($limitationValuesSet)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('ezpolicy_limitation_value'))
                ->where(
                    $query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationValuesSet))
                );
            $query->prepare()->execute();
        }
    }
public function removePolicyLimitations($policyId)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation'),
            $this->handler->aliasedColumn($query, 'id', 'ezpolicy_limitation_value')
        )->from(
            $this->handler->quoteTable('ezpolicy')
        )->leftJoin(
            $this->handler->quoteTable('ezpolicy_limitation'),
            $query->expr->eq(
                $this->handler->quoteColumn('policy_id', 'ezpolicy_limitation'),
                $this->handler->quoteColumn('id', 'ezpolicy')
            )
        )->leftJoin(
            $this->handler->quoteTable('ezpolicy_limitation_value'),
            $query->expr->eq(
                $this->handler->quoteColumn('limitation_id', 'ezpolicy_limitation_value'),
                $this->handler->quoteColumn('id', 'ezpolicy_limitation')
            )
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('id', 'ezpolicy'),
                $query->bindValue($policyId, null, \PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        $limitationIdsSet = array();
        $limitationValuesSet = array();
        while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
            if ($row['ezpolicy_limitation_id'] !== null) {
                $limitationIdsSet[$row['ezpolicy_limitation_id']] = true;
            }

            if ($row['ezpolicy_limitation_value_id'] !== null) {
                $limitationValuesSet[$row['ezpolicy_limitation_value_id']] = true;
            }
        }

        if (!empty($limitationIdsSet)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('ezpolicy_limitation'))
                ->where(
                    $query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationIdsSet))
                );
            $query->prepare()->execute();
        }

        if (!empty($limitationValuesSet)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('ezpolicy_limitation_value'))
                ->where(
                    $query->expr->in($this->handler->quoteColumn('id'), array_keys($limitationValuesSet))
                );
            $query->prepare()->execute();
        }
    }
public function removePolicyLimitations ( $ policyId ) { $ query = $ this -> handler -> createSelectQuery ( ) ; $ query -> select ( $ this -> handler -> aliasedColumn ( $ query , 'id' , 'ezpolicy_limitation' ) , $ this -> handler -> aliasedColumn ( $ query , 'id' , 'ezpolicy_limitation_value' ) ) -> from ( $ this -> handler -> quoteTable ( 'ezpolicy' ) ) -> leftJoin ( $ this -> handler -> quoteTable ( 'ezpolicy_limitation' ) , $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'policy_id' , 'ezpolicy_limitation' ) , $ this -> handler -> quoteColumn ( 'id' , 'ezpolicy' ) ) ) -> leftJoin ( $ this -> handler -> quoteTable ( 'ezpolicy_limitation_value' ) , $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'limitation_id' , 'ezpolicy_limitation_value' ) , $ this -> handler -> quoteColumn ( 'id' , 'ezpolicy_limitation' ) ) ) -> where ( $ query -> expr -> eq ( $ this -> handler -> quoteColumn ( 'id' , 'ezpolicy' ) , $ query -> bindValue ( $ policyId , null , \ PDO :: PARAM_INT ) ) ) ; $ statement = $ query -> prepare ( ) ; $ statement -> execute ( ) ; $ limitationIdsSet = array ( ) ; $ limitationValuesSet = array ( ) ; while ( $ row = $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ) { if ( $ row [ 'ezpolicy_limitation_id' ] !== null ) { $ limitationIdsSet [ $ row [ 'ezpolicy_limitation_id' ] ] = true ; } if ( $ row [ 'ezpolicy_limitation_value_id' ] !== null ) { $ limitationValuesSet [ $ row [ 'ezpolicy_limitation_value_id' ] ] = true ; } } if ( ! empty ( $ limitationIdsSet ) ) { $ query = $ this -> handler -> createDeleteQuery ( ) ; $ query -> deleteFrom ( $ this -> handler -> quoteTable ( 'ezpolicy_limitation' ) ) -> where ( $ query -> expr -> in ( $ this -> handler -> quoteColumn ( 'id' ) , array_keys ( $ limitationIdsSet ) ) ) ; $ query -> prepare ( ) -> execute ( ) ; } if ( ! empty ( $ limitationValuesSet ) ) { $ query = $ this -> handler -> createDeleteQuery ( ) ; $ query -> deleteFrom ( $ this -> handler -> quoteTable ( 'ezpolicy_limitation_value' ) ) -> where ( $ query -> expr -> in ( $ this -> handler -> quoteColumn ( 'id' ) , array_keys ( $ limitationValuesSet ) ) ) ; $ query -> prepare ( ) -> execute ( ) ; } }
Remove all limitations for a policy.

@param mixed $policyId
Remove all limitations for a policy .