Pobiera rodzeństwo elementu (wraz z nim samym)
@return \Cms\Orm\CmsCategoryRecord[]
424256
public function getSiblings()
    {
        //próba pobrania dzieci z cache
        if (null === $siblings = \App\Registry::$cache->load($cacheKey = 'category-siblings-' . $this->parentId)) {
            //pobieranie dzieci
            \App\Registry::$cache->save($siblings = $this->_getChildren($this->parentId, true), $cacheKey);
        }
        return $siblings;
    }
1096813
public function asArray()
    {
        $data = [];
        $columns = Manager::getInstance()->get($this)->getColumns();
        foreach(array_keys($columns) as $field) {
            $data[trim($field, '_')] = $this->$field;
        }
        $relations = Manager::getInstance()->get($this)->getRelations();
        foreach(array_keys($relations) as $field) {
            if ($this->$field instanceof Entity) {
                $data[trim($field, '_')] = $this->$field->asArray();
            } elseif ($this->$field instanceof RecordList) {
                $values = [];
                /** @var Entity $entity */
                foreach ($this->$field as $entity) {
                    $values[] = $entity->asArray();
                }
                $data[trim($field, '_')] = $values;
            } else {
                $data[trim($field, '_')] = $this->$field;
            }
        }
        return $data;

    }
704751
protected function _copyCategory()
    {
        $this->_createCopyRecord();
        $this->_copy->active = $this->_category->active;
        //ustawienie daty dodania na oryginalną kategorię
        $this->_copy->dateAdd = $this->_category->dateAdd;
        $this->_copy->cmsCategoryOriginalId = $this->_category->id;
        $this->_copy->status = \Cms\Orm\CmsCategoryRecord::STATUS_HISTORY;
        return $this->_copy->save();
    }
843857
public function copyAction()
    {
        $this->getResponse()->setTypeJson();
        if (null === $category = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->getPost()->id)) {
            return json_encode(['status' => false, 'error' => 'Strona nie istnieje']);
        }
        //model do kopiowania kategorii
        $copyModel = new \Cms\Model\CategoryCopy($category);
        //kopiowanie z transakcją
        if ($copyModel->copyWithTransaction()) {
            return json_encode(['status' => true, 'id' => $copyModel->getCopyRecord()->id, 'message' => $this->view->_('controller.category.copy.message')]);
        }
        return json_encode(['status' => false, 'error' => $this->view->_('controller.category.copy.error')]);
    }
1348671
public static function cmsMenus()
    {
        $result = [];
        foreach(Menu::all() as $menu){
            $result[$menu->slug] = [
              'menuID' => $menu->menuID,
              'title' => $menu->title,
              'menuLinks' => self::cmsMenuLinks(Menu::getMenuLinks($menu->slug)),
            ];
        }
        return $result;
    }
171482
protected function _prepareForwardRequest(\Cms\Orm\CmsCategoryRecord $category)
    {
        //tworzenie nowego requestu na podstawie obecnego
        $request = clone $this->getRequest();
        $request->setModuleName('cms')
            ->setControllerName('category')
            ->setActionName('article');
        //przekierowanie MVC
        if ($category->mvcParams) {
            //tablica z tpl
            $mvcParams = [];
            //parsowanie parametrów mvc
            parse_str($category->mvcParams, $mvcParams);
            return $request->setParams($mvcParams);
        }
        //pobranie typu (szablonu) i jego parametrów mvc
        if (!$category->getJoined('cms_category_type')->mvcParams) {
            return $request;
        }
        //tablica z tpl
        $mvcParams = [];
        //parsowanie parametrów mvc
        parse_str($category->getJoined('cms_category_type')->mvcParams, $mvcParams);
        return $request->setParams($mvcParams);
    }
183033
protected function elements()
    {
        $window = UrlWindow::make($this);

        return array_filter([
            $window['first'],
            is_array($window['slider']) ? '...' : null,
            $window['slider'],
            is_array($window['last']) ? '...' : null,
            $window['last'],
        ]);
    }
419742
public function getCords()
    {
        $box = $this->getBoundingBox(
            $this->getSize(),
            $this->getAngle(),
            $this->getFontface(),
            $this->getContent()
        );

        $x = $box['left'] + $this->getLeft();
        $y = $this->getTop() + $box['top'];

        if ($this->getAlign() == 'center') {
            $x = ($this->getWidth() - $box['width']) / 2;
        }

        if ($this->getValign() == 'center') {
            $y = ($this->getHeight() - $box['height']) / 2;
        }

        return [$x, $y];
    }
121401
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName('HasMain');
        $fields->addFieldsToTab(
            'Root.Main',
            array(
                TextField::create(
                    'Title',
                    _t('PlaceablePageType.TITLE', 'Title')
                )->setMaxLength(17),
                TextField::create(
                    'Description',
                    _t('PlaceablePageType.DESCRIPTION', 'Description')
                ),
                UploadField::create(
                    'Icon',
                    _t('PlaceablePageType.ICON', 'Icon')
                )
            )
        );

        $fields->addFieldToTab(
            'Root.Pages',
            GridField::create(
                'Pages',
                _t('PlaceablePageType.PAGES', 'Pages'),
                $this->Pages()
            )
        );

        $fields->addFieldToTab(
            'Root.Regions',
            GridField::create(
                'Regions',
                _t('PlaceablePageType.SECTIONS', 'Regions'),
                $this->Regions(),
                GridFieldConfig_MultiClass::create(
                    $this->Regions(),
                    singleton('RegionObject_Preset')->SubClassNames
                )
            )
        );
        return $fields;
    }
1047125
public function updateAction()
    {
        $msg = $this->view->getTranslate()->_('Zmiana właściwości nie powiodła się.');
        $this->getResponse()->setTypePlain();
        $params = explode('-', $this->id);

        //błędne dane wejściowe
        if (!($this->getPost()->selected) || count($params) != 3) {
            return $msg;
        }
        $record = (new \Cms\Orm\CmsAclQuery)->findPk($params[2]);
        if (!$record) {
            return $msg;
        }
        //zmiana zasobu
        if ($params[1] == 'resource') {
            $resource = [];
            parse_str($this->getPost()->selected, $resource);
            $record->module = strtolower($resource['module']);
            $record->controller = isset($resource['controller']) ? strtolower($resource['controller']) : null;
            $record->action = isset($resource['action']) ? strtolower($resource['action']) : null;
        } else {
            //zmiana uprawnienia z allow na deny lub odwrotnie
            $record->access = $this->getPost()->selected == 'allow' ? 'allow' : 'deny';
        }
        $record->save();
        return 1;
    }
256465
public function getOrderMethod()
    {
        //iteracja po sortowaniach w gridzie
        foreach ($this->_grid->getState()->getOrder() as $order) {
            //znalezione sortowanie tego pola
            //gdy jest podana nazwa tabeli
            if ($order->getTableName()) {
                if ($order->getTableName() . '.' . $order->getField() == $this->getName()) {
                    //zwrot metody sortowania
                    return $order->getMethod();
                }
            } else { //bez tabeli
                if ($order->getField() == $this->getName()) {
                    //zwrot metody sortowania
                    return $order->getMethod();
                }
            }
        }
    }
637728
public function getArrguments()
    {
        return [
            'model-name' => $this->modelName,
            '--table-name' => $this->tableName,
            '--connection-name' => $this->connectionName,
            '--engine-name' => $this->engineName,
            '--resource-file' => $this->resourceFile,
            '--template-name' => $this->template,
            '--without-timestamps' => $this->withoutTimestamps,
            '--with-soft-delete' => $this->withSoftDelete,
        ];
    }
228937
public function getSupportedTanMechanisms()
    {
        $segments = $this->findSegments('HIRMS');
        // @todo create method to get reference element from request
        foreach ($segments as $segment) {
            $segment = $this->splitSegment($segment);
            array_shift($segment);
            foreach ($segment as $seg) {
                list($id, $msg) = explode('::', $seg, 2);
                if ("3920" == $id) {
                    if (preg_match_all('/\d{3}/', $msg, $matches)) {
                        return $matches[0];
                    }
                }
            }
        }

        return array();
    }
750426
public function build()
    {
        if (!empty($this->build)) {
            return $this->build;
        }
        //root
        $this->build = [[
            'active' => true,
            'name' => '',
            'label' => '',
            'id' => 'root',
            'level' => 0,
            'uri' => '',
            'children' => []
        ]];
        foreach ($this->_data as $element) {
            $this->build[0]['children'][$element->getId()] = $element->build();
        }
        //usuwanie konfiguracji po zbudowaniu
        $this->_data = [];
        return $this->build;
    }
907964
public function getCategories()
    {
        if (null === $this->_categories) {

            $collection = Mage::getModel('catalog/category')->getCollection();

            $pathLike = Mage_Catalog_Model_Category::TREE_ROOT_ID . '/' . Mage::app()->getStore()->getRootCategoryId() . '/%';
            $collection
                ->initCache(Mage::app()->getCacheInstance(), self::class, [Mage_Catalog_Model_Category::CACHE_TAG])
                ->setStoreId(Mage::app()->getStore()->getId())
                ->addAttributeToSelect('*')
                ->addFieldToFilter('path', [
                    'like' => $pathLike,
                ])
                ->addIsActiveFilter()
                ->addAttributeToFilter('include_in_menu', 1)
                ->joinUrlRewrite();

            // Sort
            $collection->getSelect()->reset(Zend_Db_Select::ORDER);
            $collection
                ->addOrder('position', Varien_Data_Collection_Db::SORT_ORDER_ASC);

            foreach ($collection as $id => $category) {
                $this->_categories[$id] = $category;
            }
        }

        return $this->_categories;
    }
1142961
public function getList(): \IvoPetkov\DataList
    {
        $cacheKey = 'blog_categories_list';
        if (!isset(Internal\Data::$cache[$cacheKey])) {
            $list = Internal\Data::getList('bearcms/blog/categories/category/');
            array_walk($list, function(&$value) {
                $value = $this->makeBlogCategoryFromRawData($value);
            });

            $structureData = Internal\Data::getValue('bearcms/blog/categories/structure.json');
            $structureData = $structureData === null ? [] : json_decode($structureData, true);
            $flattenStructureData = [];
            foreach ($structureData as $itemData) {
                $flattenStructureData[] = $itemData['id'];
            }
            $flattenStructureData = array_flip($flattenStructureData);
            usort($list, function($object1, $object2) use ($flattenStructureData) {
                return $flattenStructureData[$object1->id] - $flattenStructureData[$object2->id];
            });
            unset($flattenStructureData);
            Internal\Data::$cache[$cacheKey] = $list;
            unset($list);
        }
        return new \IvoPetkov\DataList(Internal\Data::$cache[$cacheKey]);
    }
656442
public function getFiles()
    {
        $files = [];
        //import z elementów File
        foreach ($this->getElements() as $element) {
            if (!($element instanceof \Mmi\Form\Element\File)) {
                continue;
            }
            /* @var $element \Mmi\Form\Element\File */
            if (!$element->isUploaded()) {
                continue;
            }
            $files[$element->getName()] = $element->getFiles();
        }
        return $files;
    }