darya/framework

Use query() for HasMany::purge()

hexus opened this issue · 1 comments

hexus commented

This should do the trick. The only reason this isn't used is because it causes tests to fail, because InMemory storage does not set affected properly.

return (int) $this->storage()->query($this->target->table())
	->where($this->foreignKey, 0)
	->update(array(
		$this->foreignKey => $this->parent->get($this->localKey)
	))
	->cheers()->affected;
hexus commented

Woop woop.