Doctrine\OrientDB\Query\Query::truncate PHP Method

truncate() public method

Truncates an entity.
public truncate ( string $entity, boolean $andCluster = false ) : Query
$entity string
$andCluster boolean
return Query
    public function truncate($entity, $andCluster = false)
    {
        try {
            $validator = new RidValidator();
            $validator->check($entity);
            $commandClass = $this->getCommandClass('truncate.record');
        } catch (ValidationException $e) {
            $commandClass = $this->getCommandClass('truncate.class');
            if ($andCluster) {
                $commandClass = $this->getCommandClass('truncate.cluster');
            }
        }
        $this->command = new $commandClass($entity);
        return $this->command;
    }

Usage Example

Exemplo n.º 1
0
 public function testTruncateNonExistingCluster()
 {
     $query = new Query();
     $query->truncate('NON_EXISTING_CLUSTER', true);
     $this->assertHttpStatus(500, $this->doQuery($query));
 }