Пытаюсь создать ресурс с фронт енда с помощью FormIt.
все нормально все данные ловятся, но при попытке сохранить русурс выбивает:
Fatal error: Call to a member function getOption() on a non-object in Z:\home\modxxx.ru\www\core\model\modx\modresource.class.php on line 670
Немного покапавшись нарыл что в modresource.class.php он пытается генерировать УРЛ посылая в функцию
public function getAliasPath($alias = '',array $fields = array()) {
if (empty($fields)) $fields = $this->toArray();
$workingContext = $this->xpdo->getContext($fields['context_key']); /////// Вот тут образуеться этот воркконтент
if (empty($fields['uri_override']) || empty($fields['uri'])) {
/* auto assign alias if using automatic_alias */
if (empty($alias) && $workingContext->getOption('automatic_alias', false)) {
$alias = $this->cleanAlias($fields['pagetitle']);
} else {
$alias = $this->cleanAlias($alias);
}
$fullAlias= $alias;
$isHtml= true;
$extension= '';
$containerSuffix= $workingContext->getOption('container_suffix', ''); // Вот тут он пытается вызвать метод но это Не обьект =/
/* process content type */
if (!empty($fields['content_type']) && $contentType= $this->xpdo->getObject('modContentType', $fields['content_type'])) {
$extension= $contentType->getExtension();
$isHtml= (strpos($contentType->get('mime_type'), 'html') !== false);
}
/* set extension to container suffix if Resource is a folder, HTML content type, and the container suffix is set */
if (!empty($fields['isfolder']) && $isHtml && !empty ($containerSuffix)) {
$extension= $containerSuffix;
}
$aliasPath= '';
/* if using full alias paths, calculate here */
if ($workingContext->getOption('use_alias_path', false)) {
$pathParentId= $fields['parent'];
$parentResources= array ();
$query = $this->xpdo->newQuery('modResource');
$query->select($this->xpdo->getSelectColumns('modResource', '', '', array('parent', 'alias')));
$query->where("{$this->xpdo->escape('id')} = ?");
$query->prepare();
$query->stmt->execute(array($pathParentId));
$currResource= $query->stmt->fetch(PDO::FETCH_ASSOC);
while ($currResource) {
$parentAlias= $currResource['alias'];
if (empty ($parentAlias)) {
$parentAlias= "{$pathParentId}";
}
$parentResources[]= "{$parentAlias}";
$pathParentId= $currResource['parent'];
$query->stmt->execute(array($pathParentId));
$currResource= $query->stmt->fetch(PDO::FETCH_ASSOC);
}
$aliasPath= !empty ($parentResources) ? implode('/', array_reverse($parentResources)) : '';
if (!empty($aliasPath) && $aliasPath[-1] !== '/') $aliasPath .= '/';
}
$fullAlias= $aliasPath . $fullAlias . $extension;
} else {
$fullAlias= $fields['uri'];
}
return $fullAlias;
}
вообщем при попытке вызова $workingContext как объекта и вываливается... кто то сталкивался или это может баг revo 2.1 rc1 ?
покапавшись понял что $workingContext = $this->xpdo->getContext($fields[’context_key’]); возвращает null
почему х3...