Yes, but the the correct way to call them is with $modx->runProcessor():
public function runProcessor($action = '',$scriptProperties = array(),$options = array()) {
// ...
$processor->setProperties($scriptProperties);
// ...
}
Yes, correct. But this is MODx`s method. But in modProcessor class not exists $scriptProperties, exists $this->properties.
See
modProcessor::__construct()
function __construct(modX & $modx,array $properties = array()) {
$this->modx =& $modx;
$this->properties = $properties;
}
$scriptProperties - it`s in
modDeprecatedProcessor.
Yes, looks like bug. But it is not clear. Have a look: here many checking for existing data:
https://github.com/modxcms/revolution/blob/develop/core/model/modx/processors/resource/create.class.php#L193
If we already check data, we can use $this->setProperties();
But some data not checking, for example:
https://github.com/modxcms/revolution/blob/develop/core/model/modx/processors/resource/create.class.php#L206
But i want to set another creator (it`s user in frontend create documents. They not yet authorized and $modx->user != this user, but i know it`s him, and i want set creator).
And i must execute
public function setFieldDefaults(){
parent::setFieldDefaults();
$this->setDefaultProperties(array(
'createdby' => $user->id,
));
return true;
}
instead
public function setFieldDefaults(){
$this->setDefaultProperties(array(
'createdby' => $user->id,
));
return parent::setFieldDefaults();
}
So, here needs to set $this->setDefaultProperties() OR check all overwrited properties.