lib/Yucca/Component/SchemaManager.php
public function remove($tableName, array $criterias, $shardingKey = null)
    {
        $connection = $this->connectionManager->getConnection(
            $this->getConnectionName($tableName, $shardingKey, true),
            true
        );

        $shardingIdentifier = $this->getShardingIdentifier($tableName, $shardingKey);
        if (isset($shardingIdentifier)) {
            $tableName = sprintf('%1$s_%2$s', $tableName, $shardingIdentifier);
        }

        $deleteCriteria = $deleteCriteriaValues = array();
        foreach ($criterias as $columnName => $criteria) {
            if (is_array($criteria) && false == empty($criteria)) {
                $deleteCriteria[] = $columnName.' IN ('.implode(',', array_fill(0, count($criteria), '?')).')';
                $deleteCriteriaValues = array_merge($deleteCriteriaValues, $criteria);
            } else {
                $deleteCriteria[] = $columnName.' = ?';
                if ($criteria instanceof \Yucca\Model\ModelInterface) {
                    $deleteCriteriaValues[] = $criteria->getId();
                } else {
                    $deleteCriteriaValues[] = $criteria;
                }
            }
        }
        $query = 'DELETE FROM '.$tableName.' WHERE '.implode(' AND ', $deleteCriteria);

        $connection->executeUpdate($query, $deleteCriteriaValues);

        return $this;
    }
public function remove($tableName, array $criterias, $shardingKey = null)
    {
        $connection = $this->connectionManager->getConnection(
            $this->getConnectionName($tableName, $shardingKey, true),
            true
        );

        $shardingIdentifier = $this->getShardingIdentifier($tableName, $shardingKey);
        if (isset($shardingIdentifier)) {
            $tableName = sprintf('%1$s_%2$s', $tableName, $shardingIdentifier);
        }

        $deleteCriteria = $deleteCriteriaValues = array();
        foreach ($criterias as $columnName => $criteria) {
            if (is_array($criteria) && false == empty($criteria)) {
                $deleteCriteria[] = $columnName.' IN ('.implode(',', array_fill(0, count($criteria), '?')).')';
                $deleteCriteriaValues = array_merge($deleteCriteriaValues, $criteria);
            } else {
                $deleteCriteria[] = $columnName.' = ?';
                if ($criteria instanceof \Yucca\Model\ModelInterface) {
                    $deleteCriteriaValues[] = $criteria->getId();
                } else {
                    $deleteCriteriaValues[] = $criteria;
                }
            }
        }
        $query = 'DELETE FROM '.$tableName.' WHERE '.implode(' AND ', $deleteCriteria);

        $connection->executeUpdate($query, $deleteCriteriaValues);

        return $this;
    }
public function remove ( $ tableName , array $ criterias , $ shardingKey = null ) { $ connection = $ this -> connectionManager -> getConnection ( $ this -> getConnectionName ( $ tableName , $ shardingKey , true ) , true ) ; $ shardingIdentifier = $ this -> getShardingIdentifier ( $ tableName , $ shardingKey ) ; if ( isset ( $ shardingIdentifier ) ) { $ tableName = sprintf ( '%1$s_%2$s' , $ tableName , $ shardingIdentifier ) ; } $ deleteCriteria = $ deleteCriteriaValues = array ( ) ; foreach ( $ criterias as $ columnName => $ criteria ) { if ( is_array ( $ criteria ) && false == empty ( $ criteria ) ) { $ deleteCriteria [ ] = $ columnName . ' IN (' . implode ( ',' , array_fill ( 0 , count ( $ criteria ) , '?' ) ) . ')' ; $ deleteCriteriaValues = array_merge ( $ deleteCriteriaValues , $ criteria ) ; } else { $ deleteCriteria [ ] = $ columnName . ' = ?' ; if ( $ criteria instanceof \ Yucca \ Model \ ModelInterface ) { $ deleteCriteriaValues [ ] = $ criteria -> getId ( ) ; } else { $ deleteCriteriaValues [ ] = $ criteria ; } } } $ query = 'DELETE FROM ' . $ tableName . ' WHERE ' . implode ( ' AND ' , $ deleteCriteria ) ; $ connection -> executeUpdate ( $ query , $ deleteCriteriaValues ) ; return $ this ; }
@param string $tableName
@param array  $criterias
@param null   $shardingKey

@return int
@throws \Doctrine\DBAL\DBALException
@throws \Exception
@param string $tableName @param array $criterias @param null $shardingKey