{@inheritdoc}

@param Annotation\MutationAdd $annotation
168604
public function parse($annotation, \ReflectionClass $refClass, Endpoint $endpoint)
    {
        if (!$endpoint->hasTypeForClass($refClass->getName())) {
            throw new \RuntimeException(sprintf('Can\'t apply Add/Update operation to "%s", CRUD operations can only be applied to valid GraphQL object types.', $refClass->getName()));
        }

        if (!$refClass->implementsInterface(NodeInterface::class)) {
            throw new \RuntimeException(sprintf('Can\'t apply Add/Update operation to "%s", CRUD operations can only be applied to nodes. You are implementing "%s" in this class?', $refClass->getName(), NodeInterface::class));
        }

        $definition = $endpoint->getType($endpoint->getTypeForClass($refClass->getName()));
        $bundleNamespace = ClassUtils::relatedBundleNamespace($refClass->getName());

        $actionPrefix = $annotation instanceof Annotation\MutationAdd ? 'add' : 'update';
        $annotation->name = $annotation->name ?? $actionPrefix.ucfirst($definition->getName());
        $annotation->payload = $annotation->payload ?? null;
        if (!$annotation->payload) {
            //deep cloning
            /** @var ObjectDefinitionInterface $payload */
            $payloadClass = $annotation instanceof Annotation\MutationAdd ? AddNodePayload::class : UpdateNodePayload::class;
            $payload = unserialize(serialize($endpoint->getType($payloadClass)), ['allowed_classes' => true]);
            $payload->setName(ucfirst($annotation->name.'Payload'));

            if (!$endpoint->hasType($payload->getName())) {
                $payload->getField('node')->setType($definition->getName());
                $endpoint->add($payload);
            }

            $annotation->payload = $payload->getName();
        }
        $annotation->node = $annotation->node ?? $definition->getName();

        if ($endpoint->hasTypeForClass($annotation->node)) {
            $annotation->node = $endpoint->getTypeForClass($annotation->node);
        }

        $formType = null;
        $options = [];
        $generalForm = ClassUtils::applyNamingConvention($bundleNamespace, 'Form\Input', $annotation->node, $annotation->node, 'Input');
        $specificForm = ClassUtils::applyNamingConvention($bundleNamespace, 'Form\Input', $annotation->node, $annotation->name, 'Input');
        if (class_exists($specificForm)) {
            $formType = $specificForm;
        } elseif (class_exists($generalForm)) {
            $formType = $generalForm;
            $options['operation'] = $annotation->name;

            //in case the form has activated namespace operation alias
            //the operation name will be the alias
            foreach ($annotation->options as $name => $option) {
                if ($option instanceof Annotation\Plugin\Namespaces && $option->alias) {
                    $options['operation'] = $option->alias;

                }

                //support for BC using array
                if (\is_array($option) && 'namespace' === $name && $option['alias'] ?? false) {
                    $options['operation'] = $option->alias;
                }
            }
        }

        $annotation->options = array_merge(['form' => ['type' => $formType, 'options' => $options]], $annotation->options);
        $resolver = $annotation instanceof Annotation\MutationAdd ? AddNode::class : UpdateNode::class;
        $resolverReflection = new \ReflectionClass($resolver);

        $resolver = ClassUtils::applyNamingConvention($bundleNamespace, 'Mutation', $definition->getName(), $annotation->name);
        if (class_exists($resolver)) {
            $annotation->resolver = $resolver;
        }

        parent::parse($annotation, $resolverReflection, $endpoint);
    }
1268321
public function execute(RequestAnnotation $annotation, PropertyParserBuilder $propertyParser)
    {
        $propertyParser->addValidator(
            ValidatorBuilder::builder()
            ->withClass($annotation->getAssociatedClass())
            ->withSpecification($annotation->getValue())
            ->build()
        );
    }
225866
public function mutation($name, $class, $resolver = null)
    {
        $mutation = $this->mutations->findByName($name);

        if ($mutation) {
            return $mutation;
        }

        $operationScaffold = (new MutationScaffolder($name, null, $resolver, $class))
            ->setChainableParent($this);

        $this->mutations->push($operationScaffold);

        return $operationScaffold;
    }
48584
public function doesDocBlockContainAnnotation(string $annotation): bool
    {
        $docComment = (new \ReflectionClass($this->fullClassName))->getDocComment();

        if (false === $docComment) {
            return false;
        }

        return false !== strpos($docComment, $annotation);
    }
199618
public function add(DefinitionInterface $definition): Endpoint
    {
        if ($definition instanceof MutationDefinition) {
            return $this->addMutation($definition);
        }

        if ($definition instanceof QueryDefinition) {
            return $this->addQuery($definition);
        }

        return $this->addType($definition);
    }
190660
private function nested($annotation, $nestedContext)
    {
        if (property_exists($annotation, '_context') && $annotation->_context === $this->_context) {
            $annotation->_context = $nestedContext;
        }
        return $annotation;
    }
546144
private function loadAnnotations(array $annotations)
    {
        $definition = [];

        foreach ($annotations as $annotation) {
            if ($annotation instanceof Alias) {
                $definition['alias'] = $annotation->alias;
            } elseif ($annotation instanceof Type) {
                $definition['type'] = $annotation->type;
            } elseif ($annotation instanceof Expose) {
                $definition['expose'] = true;
            } elseif ($annotation instanceof Exclude) {
                $definition['exclude'] = true;
            } elseif ($annotation instanceof Readable) {
                $definition['readable'] = $annotation->readable;
            } elseif ($annotation instanceof Writable) {
                $definition['writable'] = $annotation->writable;
            } elseif ($annotation instanceof Accessor) {
                $definition['accessor'] = $annotation->accessor;
            } elseif ($annotation instanceof Mutator) {
                $definition['mutator'] = $annotation->mutator;
            } elseif ($annotation instanceof Since) {
                $definition['since'] = $annotation->version;
            } elseif ($annotation instanceof Until) {
                $definition['until'] = $annotation->version;
            } elseif ($annotation instanceof MaxDepth) {
                $definition['max_depth'] = $annotation->maxDepth;
            } elseif ($annotation instanceof Groups) {
                $definition['groups'] = $annotation->groups;
            } elseif ($annotation instanceof XmlAttribute) {
                $definition['xml_attribute'] = true;
            } elseif ($annotation instanceof XmlValue) {
                $definition['xml_value'] = true;
            } elseif ($annotation instanceof XmlCollection) {
                if ($annotation->entry !== null) {
                    $definition['xml_entry'] = $annotation->entry;
                }

                if ($annotation->entryAttribute !== null) {
                    $definition['xml_entry_attribute'] = $annotation->entryAttribute;
                }

                if ($annotation->keyAsAttribute !== null) {
                    $definition['xml_key_as_attribute'] = $annotation->keyAsAttribute;
                }

                if ($annotation->keyAsNode !== null) {
                    $definition['xml_key_as_node'] = $annotation->keyAsNode;
                }

                if ($annotation->inline !== null) {
                    $definition['xml_inline'] = $annotation->inline;
                }
            }
        }

        return $definition;
    }
466027
public static function set_annotations($gradeid, $pageno, $annotations) {
        global $DB;

        $DB->delete_records('assignfeedback_editpdf_annot', array('gradeid' => $gradeid, 'pageno' => $pageno, 'draft' => 1));
        $added = 0;
        foreach ($annotations as $record) {
            // Force these.
            if (!($record instanceof annotation)) {
                $annotation = new annotation($record);
            } else {
                $annotation = $record;
            }
            $annotation->gradeid = $gradeid;
            $annotation->pageno = $pageno;
            $annotation->draft = 1;
            if (self::add_annotation($annotation)) {
                $added++;
            }
        }

        return $added;
    }
840187
public function matches(AbstractAnnotation $annotation) {
		if (!$annotation instanceof self) {
			return false;
		}
		if ($annotation->getVariable() !== $this->variable) {
			return false;
		}

		return true;
	}
1320430
protected function tryToGetJoinColumnAnnotationOfMappedBy($annotation){
        $result = null;
        if($annotation->targetEntity && $annotation->mappedBy) {
            $result = $this->getAnnotation(
                $annotation->targetEntity,
                $annotation->mappedBy,
                'Doctrine\ORM\Mapping\JoinColumn'
            );
            if ($result === null) {
                $result = $this->getAnnotation(
                    $annotation->targetEntity,
                    $annotation->mappedBy,
                    'Doctrine\ORM\Mapping\JoinColumns'
                );
            }
        }
        return $result;
    }
57976
function callback(mutationsList, observer) {
			mutationsList.forEach(function (mutation) {
				if (mutation.type == 'childList') {
					var addedNodes = mutation.addedNodes,
						removedNodes = mutation.removedNodes,
						node,
						xnode,
						count,
						aTags,
						i;
					for (count = 0; count < addedNodes.length; count++) {
						node = addedNodes[count];
						if (!document.createCustomElement._querySelector) {
							return;
						}
						if (node.tagName && document.createCustomElement.hasOwnProperty(node.tagName.toLowerCase())) {
							if (!node._control) {
								document.createCustomElement[node.tagName.toLowerCase()].connectToNode(node);
							}
							node._control._connectedCallback();
						}
						if (node.tagName) {
							aTags = node.querySelectorAll(document.createCustomElement._querySelector);
							for (i = 0; i < aTags.length; i++) {
								xnode = aTags[i];
								if (xnode.tagName && document.createCustomElement.hasOwnProperty(xnode.tagName.toLowerCase())) {
									if (!xnode._control) {
										document.createCustomElement[xnode.tagName.toLowerCase()].connectToNode(xnode);
									}
									xnode._control._connectedCallback();
								}
							}
						}
					}
					for (count = 0; count < removedNodes.length; count++) {
						node = removedNodes[count];
						if (!document.createCustomElement._querySelector) {
							return;
						}
						if (node._control) {
							node._control._disconnectedCallback();
						}
						if (node.tagName) {
							aTags = node.querySelectorAll(document.createCustomElement._querySelector);
							for (i = 0; i < aTags.length; i++) {
								xnode = aTags[i];
								if (xnode._control) {
									xnode._control._disconnectedCallback();
								}
							}
						}
					}
				} else if (mutation.type === "attributes" && mutation.target && mutation.target._control) {
					mutation.target._control._changeProperty.call(mutation.target._control, mutation.attributeName, mutation.target.getAttribute(mutation.attributeName));
				}
			});
		}
1143300
function(d) {
      if (!d.isCaching && d.addEventListener) {
        // FireFox/Opera/Safari/KHTML have support for Mutation Events
        d.addEventListener('DOMAttrModified', mutationWrapper, true);
        d.addEventListener('DOMNodeInserted', mutationWrapper, true);
        d.addEventListener('DOMNodeRemoved',  mutationWrapper, true);
        d.isCaching = true;
      }
    }
1097771
public function add(EntityAdded $event)
    {
        $entity = $event->getEntity();
        $collection = $event->getCollection();
        $this->deleteRelation($entity, $collection);

        $repository = $this->getParentRepository();
        $adapter = $repository->getAdapter();
        $value = $collection->parentEntity()->getId();

        Sql::createSql($adapter)
            ->insert($this->getRelationTable())
            ->set(
                [
                    "{$this->getRelatedForeignKey()}" => $entity->getId(),
                    "{$this->getForeignKey()}" => $value
                ]
            )
            ->execute();
    }
638915
function (mutation) {
        // bail out for empty or unsupported mutations
        if (!(mutation && isPrimitiveMutation(mutation))) {
            return;
        }

        // if autoCompact is set, we need to compact while adding
        if (this.autoCompact) {
            this.addAndCompact(mutation);
            return;
        }

        // otherwise just push to the stream of mutations
        this.stream.push(mutation);
    }
627958
public void merge(Mutation<E,K> m) {
        Preconditions.checkNotNull(m);

        if (null != m.additions) {
            if (null == additions) additions = m.additions;
            else additions.addAll(m.additions);
        }

        if (null != m.deletions) {
            if (null == deletions) deletions = m.deletions;
            else deletions.addAll(m.deletions);
        }
    }
61262
static function alter($obj)
    {
        $tabela            = strtolower(FuncoesReflections::pegaNomeClasseObjeto($obj));
        $atributosTabela   = FuncoesReflections::pegaAtributosDoObjeto($obj);
        $annotationsTabela = Annotations::getAnnotation($obj);
        $arrFormatado      = [];
        $arrFinal          = [];
        $stringAlterTable  = "";
        for ($i = 0; $i < count($atributosTabela); $i++) {
            for ($j = 0; $j < count($annotationsTabela[$atributosTabela[$i]]); $j++) {
                $arrAtual = explode("=", $annotationsTabela[$atributosTabela[$i]][$j]);
                for ($k = 0; $k < count($arrAtual) - 1; $k++) {
                    $arrFormatado[FuncoesString::substituiOcorrenciasDeUmaString($arrAtual[$k], "@_", "")] = $arrAtual[$k + 1];
                }
            }

            $arrFinal[$i] = $arrFormatado;
        }

        $stringAlterTable .= "ALTER TABLE $tabela \n";
        $primKey = false;
        $columnPrimaryKey = "";

        $columnsTabela = self::columns($tabela);

        $arrayCamposTabela = [];
        for ($i = 0; $i < count($columnsTabela); $i++) {
            array_push($arrayCamposTabela, $columnsTabela[$i]['Field']);
        }

        $arrayDiff = array_diff($atributosTabela, $arrayCamposTabela);
        $arrayDiff = array_values($arrayDiff);

        $stringSql = $stringAlterTable;
        for ($j = 0; $j < count($arrayDiff); $j++) {
            if ($j != count($arrayDiff) - 1) {
                $stringSql .= "ADD " . $arrayDiff[$j];
            } else {
                $stringSql .= "ADD " . $arrayDiff[$j];
            }
            if (array_key_exists('type', $arrFormatado)) {

                $stringSql .= " " . $arrFormatado['type'] . "";

            } else {
                $stringSql .= "";
            }

            if (array_key_exists('size', $arrFormatado)) {

                $stringSql .= "(" . $arrFormatado['size'] . ") ";

            } else {
                $stringSql .= "";
            }

            /**
             * @todo NOT NULL AQUI
            */

            if (array_key_exists('notNull', $arrFormatado)) {
                if ($arrFormatado['notNull'] === "true") {
                    $stringSql .= " NOT NULL ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            if (array_key_exists('primaryKey', $arrFormatado)) {
                if ($arrFormatado['primaryKey'] === "true") {
                    $stringSql .= " PRIMARY KEY ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            if (array_key_exists('autoIncrement', $arrFormatado)) {
                if ($arrFormatado['autoIncrement'] === "true") {
                    $stringSql .= " AUTO_INCREMENT ";
                } else {
                    $stringSql .= "";
                };
            } else {
                $stringSql .= "";
            }

            $fileContent = JsonReader::read(BASE_DIR."/phiber_config.json")->phiber->code_sync == 1 ? true : false;
            if ($fileContent) {
                $pdo = self::getConnection()->prepare($stringSql);
                $pdo->execute();
            }
        }

        $columnsTabela = self::columns($tabela);
        for ($i = 0; $i < count($arrFinal); $i++) {
            if ($columnsTabela[$i]['Field'] != $atributosTabela[$i]) {
                $stringAlterTable .= "CHANGE `" . $columnsTabela[$i]['Field'] . "` `$atributosTabela[$i]` ";
                $stringAlterTable .= strtoupper($arrFinal[$i]['type']) . "(" . $arrFinal[$i]['size'] . ")\n";

                if ($arrFinal[$i])

                    if ($i != count($arrFinal) - 1) {
                        $stringAlterTable .= ", \n";
                    }
            } else {
                $stringAlterTable .= "CHANGE  `$atributosTabela[$i]` `$atributosTabela[$i]` ";

                $stringAlterTable .= strtoupper($arrFinal[$i]['type']) . "(" . $arrFinal[$i]['size'] . ")";

                $respIfNotNull = $columnsTabela[$i]['Null'] == 'NO' ? 'false' : 'true';

                if ($arrFinal[$i]['notNull'] == $respIfNotNull) {
                    $stringAlterTable .= " NOT NULL ";
                } else {
                    $stringAlterTable .= " NULL ";
                }

                if (array_key_exists('default', $arrFinal[$i]) && $arrFinal[$i]['default'] != "none") {
                    $stringAlterTable .= "DEFAULT '" . $arrFinal[$i]['default'] . "'";
                }

                if (array_key_exists('autoIncrement', $arrFinal[$i]) && $arrFinal[$i]['autoIncrement'] != "false") {
                    $stringAlterTable .= " AUTO_INCREMENT ";
                }

                $stringAlterTable .= ", \n";

                if ($arrFinal[$i]['primaryKey'] == "true" and $primKey != true) {
                    $primKey = true;
                    $columnPrimaryKey = $atributosTabela[$i];
                }
                if ($i == count($arrFinal) - 1) {
                    if ($primKey) {
                        $stringAlterTable .= " DROP PRIMARY KEY, ADD PRIMARY KEY(`$columnPrimaryKey`);";
                    } else {
                        $stringAlterTable .= " DROP PRIMARY KEY";
                    }
                }
            }
        }

        $jsonFile = JsonReader::read(BASE_DIR."/phiber_config.json")->phiber->code_sync == 1 ? true : false;
        if ($jsonFile) {
            $pdo = self::getConnection()->prepare($stringAlterTable);
            if ($pdo->execute()) {
                return true;
            };
        } else {
            return $stringAlterTable;
        }
        return false;
    }
983631
def append(self, annotation):
        
        self._annotations[annotation.id] = annotation
        self._dirty = True
        return annotation