Wird aufgerufen für einen Eintrag in einer collection (kann auch unterverschachtelt sein)

item kann noch ein nicht-Basis-Typ sein und kann dann mit $this->walk($item, $itemType) aufgelöst werden
184954
public function walkCollectionItem($item, Type $itemType, $key, $collection, Type $collectionType) {
    $walkedItem = $this->walk($item, $itemType); // demo zwecke (wir vergessen hier was mit key zu machen)
    return $this->decorateCollectionItem($walkedItem, $key);
  }
281384
public function moveAction()
    {
        $this->getResponse()->setTypeJson();
        //brak kategorii
        if (null === $masterCategory = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->getPost()->id)) {
            return json_encode(['status' => false, 'error' => $this->view->_('controller.category.move.error.missing')]);
        }
        //domyślnie nie ma drafta - alias
        $draft = $masterCategory;
        //zmiana parenta tworzy draft
        if ($this->getPost()->parentId != $masterCategory->parentId) {
            //tworzenie draftu
            $draft = (new \Cms\Model\CategoryDraft($masterCategory))->createAndGetDraftForUser(\App\Registry::$auth->getId(), true);
        }
        //zapis kolejności
        $draft->parentId = ($this->getPost()->parentId > 0) ? $this->getPost()->parentId : null;
        $draft->order = $this->getPost()->order;
        //próba zapisu
        return ($draft->save() && $draft->commitVersion()) ? json_encode(['status' => true, 'id' => $masterCategory->id, 'message' => $this->view->_('controller.category.move.message')]) : json_encode(['status' => false, 'error' => $this->view->_('controller.category.move.error')]);
    }
985991
public function jsonDataAction()
    {
        $limit = null; $start = null; $order = 0;
        if ($this->_paging) {
            $limit = $this->getRequest()->getParam('limit');
            $start = $this->getRequest()->getParam('start');
            if (!$limit) {
                if (!is_array($this->_paging) && $this->_paging > 0) {
                    $limit = $this->_paging;
                } else if (is_array($this->_paging) && isset($this->_paging['pageSize'])) {
                    $limit = $this->_paging['pageSize'];
                } else {
                    $limit = $this->_paging;
                }
            }

// wird vermutlich nicht benötigt, da beim ersten laden 'sortInfo' in den metadaten drin ist
// falls es irgendwo benötigt wird wieder einkommentieren
//             $this->view->order = $order;
        }

        //TODO: dieser code sollte in _getOrder liegen
        $order = $this->_defaultOrder;
        if ($this->getRequest()->getParam('sort')) {
            $order['field'] = $this->getRequest()->getParam('sort');
        }
        if ($this->_getParam("direction") && $this->_getParam('direction') != 'undefined') {
            $order['direction'] = $this->_getParam('direction');
        }

        $primaryKey = $this->_primaryKey;

        $rowSet = $this->_fetchData($order, $limit, $start);
        if (!is_null($rowSet)) {
            if (isset($this->_paging['type']) && $this->_paging['type'] == 'Date') {
                //nothing to do, we don't know the total
            } else if ($this->_paging) {
                $this->view->total = $this->_fetchCount();
            } else {
                $this->view->total = sizeof($rowSet);
            }

            $number = 0;
            if ($start) $number = $start;
            $rows = array();
            foreach ($rowSet as $row) {
                $r = array();
                if (is_array($row)) {
                    $row = (object)$row;
                }
                if (!$this->_hasPermissions($row, 'load')) {
                    throw new Kwf_Exception("You don't have the permissions to load this row");
                }
                foreach ($this->_columns as $column) {
                    if ($column instanceof Kwf_Grid_Column_RowNumberer) continue;
                    if ($column->getShowIn() & Kwf_Grid_Column::SHOW_IN_GRID) {
                        $data = $column->load($row, Kwf_Grid_Column::ROLE_DISPLAY, array(
                                                    'number' => $number,
                                                    'total' => $this->view->total,
                                                ));
                        $r[$column->getDataIndex()] = $data;
                    }
                }
                if (!isset($r[$primaryKey]) && isset($row->$primaryKey)) {
                    $r[$primaryKey] = $row->$primaryKey;
                }
                $rows[] = $r;
                $number++;
            }

            $this->view->rows = $rows;
        } else {
            $this->view->total = 0;
            $this->view->rows = array();
        }

        if ($this->getRequest()->getParam('meta')) {
            $this->_appendMetaData();
        }
    }
550173
public function editItem()
    {
        $this->defaultData();

        $itemClass = $this->getCurrentClass();
        $item = $this->getCurrentInstance();

        if(!$this->isLocked($item, 'item_locked.tpl')){

            // my lock
            $lock = LockManager::getImplementation()->getLockData($item);
            if (!is_null($lock) && $lock->getOwnerId() == $this->getSession()->getUser()->getIdentifier()) {
                $this->setData('lockDate', $lock->getCreationTime());
                $this->setData('id', $item->getUri());
            }

            $formContainer = new SignedFormInstance($itemClass, $item);
            $myForm = $formContainer->getForm();

            $itemUri = $item->getUri();
            if ($this->hasWriteAccess($itemUri)) {
                if($myForm->isSubmited() && $myForm->isValid()){
                    $this->validateInstanceRoot($itemUri);

                    $properties = $myForm->getValues();
                    if (array_key_exists('warning', $properties)) {
                        $this->logWarning('Warning property is still in use', ['backend']);
                        unset($properties['warning']);
                    }

                    //bind item properties and set default content:
                    $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($item);
                    $item = $binder->bind($properties);

                    $this->getEventManager()->trigger(new ItemUpdatedEvent($item->getUri(), $properties));
                    $this->getEventManager()->trigger(new ItemRdfUpdatedEvent($item->getUri(), $properties));

                    //if item label has been changed, do not use getLabel() to prevent cached value from lazy loading
                    $label = $item->getOnePropertyValue(new core_kernel_classes_Property(OntologyRdfs::RDFS_LABEL));
                    $this->setData("selectNode", tao_helpers_Uri::encode($item->getUri()));
                    $this->setData('label', ($label != null) ? $label->literal : '');
                    $this->setData('message', __('Item saved'));
                    $this->setData('reload', true);
                }
            } else {
                $myForm->setActions([]);
            }

            $currentModel = $this->getClassService()->getItemModel($item);
            $hasPreview = false;
            $hasModel   = false;
            if(!empty($currentModel)) {
                $hasModel = true;
                $isDeprecated = $this->getClassService()->hasModelStatus($item, array(ItemModelStatus::INSTANCE_DEPRECATED));
                $hasPreview = !$isDeprecated && $this->getClassService()->hasItemContent($item);
            }

            $updatedAt = $this->getServiceLocator()->get(ResourceWatcher::SERVICE_ID)->getUpdatedAt($item);
            $this->setData('isPreviewEnabled', $hasPreview);
            $this->setData('updatedAt', $updatedAt);
            $this->setData('isAuthoringEnabled', $hasModel);

            $this->setData('formTitle', __('Edit Item'));
            $this->setData('myForm', $myForm->render());

            $this->setView('Items/editItem.tpl');
        }
    }
1273627
public function automap() {
        $map = array();

        // Shallow copy.
        $collectionfrom = $this->get_collection_from();
        $collectionto = $this->get_collection_to();

        // Find mappings.
        foreach ($collectionfrom as $keyfrom => $compfrom) {
            foreach ($collectionto as $keyto => $compto) {
                if ($compfrom->get('idnumber') == $compto->get('idnumber')) {
                    $map[$compfrom->get('id')] = $compto->get('id');
                    unset($collectionfrom[$keyfrom]);
                    unset($collectionto[$keyto]);
                    break;
                }
            }
        }

        $this->mappings = $map;
    }
222449
function (item) {
        let result = {};
        if (item === __private.local) {
            Object.keys(__private.local).forEach(function (e) {
                result = Object.assign(result, _getLocalItems(__private.local[e]));
            });
            return result;
        }
        switch (item.type) {
            case Type.STRING:
            case Type.NUMBER:
            case Type.BOOLEAN:
            case Type.UNDEFINED:
                result[item.key] = item.timestamp;
                break;
            case Type.ARRAY:
            case Type.OBJECT:
                item.value.forEach(function (e) {
                    result = Object.assign(result, _getLocalItems(e));
                });
                break;
            default:
                _logUnknownType(item.type);
        }
        return result;
    }
407919
function collection$$1(eles, opts) {
    if (string(eles)) {
      return this.$(eles);
    } else if (elementOrCollection(eles)) {
      return eles.collection();
    } else if (array(eles)) {
      return new Collection(this, eles, opts);
    }

    return new Collection(this);
  }
612899
protected function validateCollectionCollectionItem()
    {
        $field = 'collection_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $collection_id = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($collection_id)) {
            return null;
        }

        $label = $this->translation->text('Collection');

        if (empty($collection_id)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_numeric($collection_id)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        $collection = $this->collection->get($collection_id);

        if (empty($collection)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        $this->setSubmitted('collection', $collection);
        return true;
    }
152945
function collectInformation( $collection, &$collectionAttribute, $http, $base )
    {
        $dataType = $this->dataType();
        if ( $dataType )
        {
            $collectionAttribute->setAttribute( 'contentclass_attribute_id', $this->attribute( 'contentclassattribute_id' ) );
            $collectionAttribute->setAttribute( 'contentobject_attribute_id', $this->attribute( 'id' ) );
            $collectionAttribute->setAttribute( 'contentobject_id', $this->attribute( 'contentobject_id' ) );
            return $dataType->fetchCollectionAttributeHTTPInput( $collection, $collectionAttribute, $http, $base, $this );
        }

        return false;
    }
199463
public function php() {
    $cr = "\n";
    
    $php = $this->phpDocBlock(0);
    
    $ms = array(self::MODIFIER_ABSTRACT => 'abstract',
                self::MODIFIER_FINAL => 'final'
               );
    
    foreach ($ms as $const => $modifier) {
      if (($const & $this->modifiers) == $const)
        $php .= $modifier.' ';
    }
    
    $php .= 'class '.$this->getClassName().' ';
    
    /* Extends */
    if (isset($this->parentClass)) {
      if ($this->parentClass->getNamespace() === $this->getNamespace()) {
        $php .= 'extends '.$this->parentClass->getClassName().' '; // don't prefix namespace
      } else {
        $php .= 'extends '.'\\'.$this->parentClass->getFQN().' ';
      }
    }
    
    /* Interfaces */
    if (count($this->getInterfaces()) > 0) {
      $php .= 'implements ';
      $that = $this;
      $php .= A::implode($this->getInterfaces(), ', ', function (GClass $iClass) use ($that) {
        if ($that->getNamespace() === $iClass->getNamespace()) {
          return $iClass->getClassName();
        } else {
          return '\\'.$iClass->getFQN();
        }
      });
      $php .= ' ';
    }
    
    $php .= '{'.$cr;
    /* Die Funktionen machen immer den Abstand nach oben. Also vor jedem Property und jeder Methode macht dies ein "\n" */

    /* Constants */
    $php .= A::joinc($this->getConstants(), '  '.$cr.'%s;'.$cr, function ($constant) {
      return $constant->php(2);
    });
    
    /* Properties */
    $php .= A::joinc($this->getProperties(), '  '.$cr.'%s;'.$cr, function ($property) {
      return $property->php(2); // hier jetzt auch wegen DocBlock einrücken
    });

    /* Methods */
    $php .= A::joinc($this->getMethods(), '  '.$cr.'%s'.$cr, function ($method) {
      return $method->php(2); // rückt selbst zwischen den Klammern ein, aber wir wollen ja den body z.b. auf 4 haben nicht auf 2
    });
    
    $php .= '}'; // kein umbruch hinten, immer abstand nach oben!
    return $php;
  }
317318
function getValue(item, keyOrPath) {
  const keys = keyOrPath.split('.');
  const used = [];
  while (keys.length > 0) {
    const key = keys.shift();
    used.push(key);
    if (!isValid(item[key])) {
      throw new Error(`path ${used.join('.')} is not an object`);
    }
    item = item[key];
  }
  return item[keys[0]];
}
67954
function it_can_execute_functions_for_each_item_in_a_collection()
    {
        $collection = [1, 2, 3];

        $this
            ->each($collection, function($item) {
                $this->raw($item);
            })
            ->getSource()
            ->shouldMatch('/123/')
        ;
    }
296725
function processItemtype(item, processedItems) {
  processedItems.push({
    'id':         md5($(item).html()),
    'name':       $(item).attr('itemtype'),
    'properties': {}
  });

}
1018854
function $item(corq, item){
		var typeName = item.type;
		if (!corq.callbacks[typeName]){
			throw "Item handler not found for items of type `" + typeName + "`";
		}
		$debug(corq, 'Corq: Calling handler for item `' + typeName + '`');
		$debug(corq, item.data);
		var _next = function(){
			var freq = (corq.delay) ? corq.delayLength : corq.frequency;
			setTimeout(function(){
				$next(corq);
			}, freq);
		};
		var _success = function(){
			$debug(corq, 'Corq: Item processing SUCCESS `' + typeName + '` ');
			$debug(corq, item.data);
			$success(corq,item);
			_next();
		};
		var _fail = function(){
			$debug(corq, 'Corq: Item processing FAILURE `' + typeName + '` ');
			$debug(corq, item.data);
			$fail(corq, item);
			_next();
		};
		try {
			corq.callbacks[typeName](item.data, _success, _fail);
		}catch(e){
			$debug(corq, 'Corq: Error thrown by item processing function `' + typeName + '` ');
			$debug(corq, item.data);
			_fail();
			throw e;
		}
	}
961273
public static function toDate($object, $objectId, $year, $month, $day)
    {
        $now = strtotime($year . '-' . $month . '-' . $day);
        $prev = strtotime('-1 month', $now);

        $raw = [];
        //uzupełnianie danych surowych poprzednim miesiącem
        foreach (self::getRows($object, $objectId, date('Y', $prev), date('m', $prev), true, null) as $stat) {
            $raw[$stat->year . '-' . $stat->month . '-' . $stat->day] = $stat->count;
        }
        //uzupełnianie danych surowych obecnym miesiącem
        foreach (self::getRows($object, $objectId, date('Y', $now), date('m', $now), true, null) as $stat) {
            $raw[$stat->year . '-' . $stat->month . '-' . $stat->day] = $stat->count;
        }
        $statArray = [];

        //uzupełnianie dni
        for ($i = 30; $i > -1; $i--) {
            $curTime = strtotime('-' . $i . ' day', $now);
            $count = 0;
            if (isset($raw[date('Y', $curTime) . '-' . ltrim(date('m', $curTime), '0') . '-' . ltrim(date('d', $curTime), '0')])) {
                $count = $raw[date('Y', $curTime) . '-' . ltrim(date('m', $curTime), '0') . '-' . ltrim(date('d', $curTime), '0')];
            }
            $statArray[date('m.d', $curTime)] = $count;
        }
        return $statArray;
    }
386868
function route(
    $path = '/', $actions, $method = Router::ANY_METHOD, $name = null, array $filters = [], array $events = []
    )
    {
        if (is_array($path)) {
            foreach ($path as $p) {
                $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                        ->route($p, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
            }
        } else {
            $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                    ->route($path, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
        }

        return $this;
    }
614151
protected function resolveItems(Collection &$items): void
    {
        $resolver = function ($property) {
            return $this->resolve($property) ?: $property;
        };

        $items->each(function (MenuItem $item) use ($resolver) {
            $item->fill(array_map($resolver, $item->properties));
        });
    }