Sets this property's value in the given entity.

@param Relation|Node $entity The entity to set the property of.
@param mixed $value The value to set it to.
332489
function setValue($entity, $value)
    {
        switch ($this->format)
        {
            case 'scalar':
                $this->property->setValue($entity, $value);
                break;

            //Unserialize classes and arrays before putting them back in the entity.
            case 'object':
            case 'array':
                $this->property->setValue($entity, unserialize($value));
                break;

            //Decode Json from DB back into a regular assoc array before putting it into the entity.
            case 'json':
                $this->property->setValue($entity, json_decode($value, true));
                break;

            //Create a date time object out of the db stored date before putting it into the entity.
            case 'date':
                $date = null;
                if ($value) {
                    $date = new \DateTime($value . ' UTC');
                    $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
                }

                $this->property->setValue($entity, $date);
                break;
        }
    }
1270220
public function set($key, $value)
    {
        if (! $value instanceof RelationInterface) {
            throw new InvalidArgumentException(
                "Only RelationInterface objects can be putted in a ".
                "RelationsMap."
            );
        }
        return parent::set($key, $value);
    }
736187
public function setNewValue(string $field, $value) : void
    {
        $this->assertValidField($field);

        $this->entityChangeSet[$field][1] = $value;
    }
1288114
public function setProperty($propertyName, $value)
    {
        if (!is_object($this->contentObjectProxy)) {
            switch ($this->getNodeType()->getPropertyType($propertyName)) {
                case 'references':
                    $nodeIdentifiers = [];
                    if (is_array($value)) {
                        foreach ($value as $nodeIdentifier) {
                            if ($nodeIdentifier instanceof NodeInterface || $nodeIdentifier instanceof AbstractNodeData) {
                                $nodeIdentifiers[] = $nodeIdentifier->getIdentifier();
                            } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $nodeIdentifier) !== 0) {
                                $nodeIdentifiers[] = $nodeIdentifier;
                            }
                        }
                    }
                    $value = $nodeIdentifiers;
                    break;
                case 'reference':
                    $nodeIdentifier = null;
                    if ($value instanceof NodeInterface || $value instanceof AbstractNodeData) {
                        $nodeIdentifier = $value->getIdentifier();
                    } elseif (preg_match(NodeIdentifierValidator::PATTERN_MATCH_NODE_IDENTIFIER, $value) !== 0) {
                        $nodeIdentifier = $value;
                    }
                    $value = $nodeIdentifier;
                    break;
            }

            $this->persistRelatedEntities($value);

            if (array_key_exists($propertyName, $this->properties) && $this->properties[$propertyName] === $value) {
                return;
            }

            $this->properties[$propertyName] = $value;

            $this->addOrUpdate();
        } elseif (ObjectAccess::isPropertySettable($this->contentObjectProxy->getObject(), $propertyName)) {
            $contentObject = $this->contentObjectProxy->getObject();
            ObjectAccess::setProperty($contentObject, $propertyName, $value);
            $this->updateContentObject($contentObject);
        }
    }
518530
public function set($key, $value = null) {

        // Do not trigger state changes for relations
        if (!$this->hasRelation($key)) {

            // Only flag changed if the value is different
            if ($value != $this->get($key) && !in_array($key, $this->reserved)) {
                $this->_changed = true;
            }

            // Run the value through a mutator but do not set the mutator key
            if ($method = $this->hasMutator($key)) {
                $this->{$method}($value);

                return $this;
            }
        }

        $this->_attributes[$key] = $value;

        return $this;
    }
920437
private function oneToOne(&$structure, $property, $relation)
    {
        $from = $structure->name;
        $to = $relation->targetEntity;

        $reflection = null;
        try {
            $reflection = new \ReflectionClass($to);
        }catch(\Exception $e) { // @codeCoverageIgnore
            // Ignore, we will throw error on the next if.
        }
        if ($reflection === null || ! $reflection->isSubclassOf(Entity::class)) {
            throw new RelationException("The target entity of your relation on the entity '".$from."' and property '".$property->getName()."' has an unknown target Entity!"); // @codeCoverageIgnore
        }

        // Get join and set the join into the relation
        $join = $this->getJoin($property);
        $relation->join = $join;

        // Add declaration to the structure
        $structure->relationProperties[] = $property->getName();
        $structure->foreignColumnNames[] = $join->column;
        $structure->relations[$property->getName()] = $relation;
    }
1332195
public function set($property, $value)
    {
        if ($this->_convert) {
            $property = str_replace( "_", "-", $property );
        } else {
            $property = str_replace( "-", "_", $property );
        }

        $this->_values[$property] = $value;
    }
1027575
public function set($key, $value)
    {
        if (! $value instanceof EntityDescriptorInterface) {
            throw new InvalidArgumentException (
                "Invalid descriptor. DescriptorsCollection only accepts ".
                "EntityDescriptorInterface object."
            );
        }
        return parent::set($key, $value);
    }
548844
public function addRel($relation, $value)
        {
            if (is_string($relation)) {
                $this->_rel[$relation] = $value;
            }

            return $this;
        }
1346772
public function setRelatedId( $id )
	{
		if ( $id === $this->getRelatedId() ) { return; }
		$id = (int) $id;
		$this->_values['relatedid'] = $id;
		$this->setModified();
	}
478216
public function build(Entity $entity): void
    {
        $attributes = $entity->getEntityAttributes();

        // We will manually add a relationship for every attribute registered
        // of this entity. Once we know the relation method we have to use,
        // we will just add it to the entityAttributeRelations property.
        foreach ($attributes as $attribute) {
            $relation = $this->getRelationClosure($entity, $attribute);

            $entity->setEntityAttributeRelation($attribute->getAttribute('slug'), $relation);
        }
    }
537912
protected function setValue($entity, $value, $setter)
    {
        if (method_exists($entity, $setter)) {
            $entity->$setter($value);
        }
    }
6868
protected function setEntityAttributeValue($entity, $field, $value)
    {
        $functionName = 'set'.ucfirst($field);

        call_user_func([$entity, $functionName], $value);
    }
243096
public function setNewValue($field, $value)
    {
        $this->assertValidField($field);

        $this->entityChangeSet[$field][1] = $value;
    }
70539
public function setAttribute($node, $name, $value)
    {
        if (is_string($node)) {
            $node = $this->getNode($node);
        }

        if ($node) {
            $node->setAttribute($name, $value);
        }
    }
485297
public function set($key, $value)
    {
        $this->assertConstraintInstance($value);

        parent::set($key, $value);
    }
482642
public function setRelationIds($name, $value)
    {
        if (!$this->isRelation($name, false)) {
            throw new UnknownPropertyException('Setting unknown relation: ' . get_called_class() . '::' . $name);
        }

        $this->markChanged($name);
        $this->values->set($name, $this->normalizeValue($value));
    }