/**
* @param string $method
* @param array $args
* @return mixed
*/
public function callResourceMethod($method, $args)
{
$resource = $this->getResource();
if ($this->inTransaction || Db::isWriteQuery($method, $args)) {
$resource = $this->getWriteResource();
}
$capture = false;
if (\Pimcore::inAdmin()) {
$methodsToCheck = array("query", "update", "delete", "insert");
if (in_array($method, $methodsToCheck)) {
$capture = true;
Db::startCapturingDefinitionModifications($resource, $method, $args);
}
}
$r = call_user_func_array(array($resource, $method), $args);
if (\Pimcore::inAdmin() && $capture) {
Db::stopCapturingDefinitionModifications($resource);
}
return $r;
}