Collects the parameters for inserting/deleting on the join table in the order
of the join table columns.

@param object $element

@return mixed[]
557115
private function collectJoinTableColumnParameters(PersistentCollection $collection, $element)
    {
        $params           = [];
        $association      = $collection->getMapping();
        $owningClass      = $this->em->getClassMetadata(get_class($collection->getOwner()));
        $targetClass      = $collection->getTypeClass();
        $owningIdentifier = $this->uow->getEntityIdentifier($collection->getOwner());
        $targetIdentifier = $this->uow->getEntityIdentifier($element);
        $joinTable        = $association->getJoinTable();

        foreach ($joinTable->getJoinColumns() as $joinColumn) {
            $fieldName = $owningClass->fieldNames[$joinColumn->getReferencedColumnName()];

            $params[] = $owningIdentifier[$fieldName];
        }

        foreach ($joinTable->getInverseJoinColumns() as $joinColumn) {
            $fieldName = $targetClass->fieldNames[$joinColumn->getReferencedColumnName()];

            $params[] = $targetIdentifier[$fieldName];
        }

        return $params;
    }
1183490
public function remove($element) {
		$index = array_search($element, $this->collection, true);
		if ($index !== null) {
			unset($this->collection[$index]);
		}

		return $this;
	}
1193121
protected function generateColumns($table): array
    {
        $columns = $table->getColumns();
        $result  = [
            'columns'          => [],
            'hasSoftDelete'    => false,
            'hasRememberToken' => false,
        ];
        foreach ($columns as $column) {
            if ($column->getName() === 'id') {
                continue;
            }
            if (($column->getName() === 'created_at' || $column->getName() === 'updated_at') and ($column->getType() === 'timestamp' || $column->getType() === 'timestamp_f')) {
                continue;
            }
            if ($column->getName() === 'deleted_at' and ($column->getType() === 'timestamp' || $column->getType() === 'timestamp_f')) {
                $result['hasSoftDelete'] = true;
                continue;
            }
            if ($column->getName() === 'remember_token' and $column->getType() === 'varchar') {
                $result['hasRememberToken'] = true;
                continue;
            }

            $columnObject = new Column($column);
            $line         = $columnObject->generateAddMigration();

            $result['columns'][] = $line.';';
        }

        return $result;
    }
90584
public function lastIndexOf($element) {
        for ($i = (count($this->_elements) - 1); $i > 0; $i--) {
            if ($element == $this->get($i)) { return $i; }
        }
    }
1071571
private function getFieldElement($element)
    {
        $element = $this->getElement($element);
        while (null !== $element && !$element->hasClass('field')) {
            $element = $element->getParent();
        }

        return $element;
    }
47135
public static function parseElement($element)
    {
        if ($element->getName() == "rowset") {
            $re = new RowSet($element);
        } elseif ($element->getName() == "result" && $element->member) { // corp/MemberSecurity workaround
            $container = new Container();
            $container->addElement('members', new PhealRowSet($element, 'members', 'member'));
            $re = new Element('result', $container);
        } else {
            $key = $element->getName();
            $echilds = $element->children();
            if (count($echilds) > 0) {
                $container = new Container();
                foreach ($echilds as $celement) {
                    $cel = Element::parseElement($celement);
                    if (count($celement->attributes()) > 0) {
                        $container->addElement($cel->_name, $cel);
                    } else {
                        $container->addElement($cel->_name, $cel->_value);
                    }
                }
                $value = $container;
            } else {
                $value = (String)$element;
            }

            $re = new Element($key, $value);
            /** @var $element \SimpleXMLElement */
            if (count($element->attributes()) > 0) {
                foreach ($element->attributes() as $name => $attelem) {
                    $re->addAttrib($name, (String)$attelem);
                }
            }

        }
        return $re;
    }
1211203
private function getElementsToProcess(): array
    {
        $result = [];

        foreach (get_object_vars($this) as $element) {
            if ($element instanceof FormElementInterface) {
                $result[] = $element;
            }
        }

        $result = array_merge($result, $this->extraElements);

        return $result;
    }
358866
public function add( $element ) {
		if ( $this->type->is_model() && is_array( $element ) ) {
			$element = $this->type->create_model( $element );
		}

		$this->type->validate_element( $element );

		$elements   = $this->elements;
		$elements[] = $element;

		$collection = new static( $this->get_type() );
		$collection->set_from_trusted( $elements );

		return $collection;
	}
865498
protected function assembleComponent($element)
    {
        $options   = $this->getOptions();
        $element   = parent::__invoke($element);
        $component = sprintf(
            '<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s',
            $options['class'],
            $options['color'],
            $options['format'],
            $element
        ) . sprintf(
            '<span class="add-on"><i style="background-color: %s;"></i></span></div>',
            $options['color']
        );

        return $component;
    }
444513
public function getAttributesFromElement( $element )
	{
		$list	= array();
		foreach( $element->attributes as $key => $value )
			$list[$key]	= $value->textContent;
		return $list;
	}
403033
private function filterElements(array $elements): array
    {
        $filteredElements = [];

        foreach ($elements as $element) {
            if (!$this->elementExcluder->isExcluded($element) && $this->hasUrlAttribute($element)) {
                $filteredElements[] = $element;
            }
        }

        return $filteredElements;
    }
534035
protected function element($element = null)
    {
        return is_null($element)
            ? $this->element
            : ($this->element = $element);
    }
1276863
public function replaceAll($element)
    {
        $e = self::create($element);
        $newnodes = array();
        foreach ($e as $i => $node) {
            /** @var \DOMNode $node */
            $parent = $node->parentNode;
            $refnode  = $node->nextSibling;
            foreach ($this as $j => $newnode) {
                /** @var \DOMNode $newnode */
                $newnode = static::importNewnode($newnode, $node, $i);
                if ($j == 0) {
                    $parent->replaceChild($newnode, $node);
                } else {
                    $parent->insertBefore($newnode, $refnode);
                }
                $newnodes[] = $newnode;
            }
        }
        return self::create($newnodes);
    }
1345251
private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
    {
        $joinColumn = array(
            'name' => (string)$joinColumnElement['name'],
            'referencedColumnName' => (string)$joinColumnElement['referenced-column-name']
        );

        if (isset($joinColumnElement['unique'])) {
            $joinColumn['unique'] = $this->evaluateBoolean($joinColumnElement['unique']);
        }

        if (isset($joinColumnElement['nullable'])) {
            $joinColumn['nullable'] = $this->evaluateBoolean($joinColumnElement['nullable']);
        }

        if (isset($joinColumnElement['on-delete'])) {
            $joinColumn['onDelete'] = (string)$joinColumnElement['on-delete'];
        }

        if (isset($joinColumnElement['column-definition'])) {
            $joinColumn['columnDefinition'] = (string)$joinColumnElement['column-definition'];
        }

        return $joinColumn;
    }
632472
protected function processRules($element)
	{
		// If this is a container (Form or Fieldset) loop through each of the fields
		if ($element instanceof Form or $element instanceof Fieldset)
		{
			$result = [];

			foreach ($element as $field)
			{
				$result += $this->processRules($field);
			}

			return $result;
		}

		$metaData = $element->getMetaContainer();

		if (isset($metaData['validation']))
		{
			$label = $element->getLabel();

			if (is_null($label))
			{
				$label = $element->getName();
			}

			return [$element->getName() => [
				$this->ruleProvider->getRuleKey() => $metaData['validation'],
				$this->ruleProvider->getLabelKey() => $label,
			]];
		}

		return [$element->getName() => []];
	}
1324528
private function parseElement(array $element)
    {
        $elementXml = $this->dom->createElement('xsd:element');
        foreach ($element as $key => $value) {
            if (in_array($key, array('sequence', 'all', 'choice'))) {
                if (is_array($value)) {
                    $complexType = $this->dom->createElement('xsd:complexType');
                    if (count($value) > 0) {
                        $container = $this->dom->createElement('xsd:' . $key);
                        foreach ($value as $subElement) {
                            $subElementXml = $this->parseElement($subElement);
                            $container->appendChild($subElementXml);
                        }

                        $complexType->appendChild($container);
                    }

                    $elementXml->appendChild($complexType);
                }
            } else {
                $elementXml->setAttribute($key, $value);
            }
        }

        return $elementXml;
    }
625173
protected function getItemReferenceElements(\DOMElement $element)
    {
        $itemrefElements = [];
        $itemrefs = trim($element->getAttribute('itemref'));
        $itemrefs = strlen($itemrefs) ? preg_split('/\s+/', $itemrefs) : [];
        foreach ($itemrefs as $itemref) {
            $itemrefElement = $element->ownerDocument->getElementById($itemref);
            if ($itemrefElement instanceof \DOMElement) {
                $itemrefElements[] = $itemrefElement;
            }
        }
        return $itemrefElements;
    }