sets Entity's Main-Fax.

@param Contact|AccountInterface $entity
8794
public function setMainFax($entity)
    {
        // set main to first entry or to null
        if ($entity->getFaxes()->isEmpty()) {
            $entity->setMainFax(null);
        } else {
            $entity->setMainFax($entity->getFaxes()->first()->getFax());
        }
    }
1224644
protected function updateFax(Fax $fax, $entry)
    {
        $success = true;

        $faxType = $this->em->getRepository(
            self::$faxTypeEntityName
        )->find($entry['faxType']['id']);

        if (!$faxType) {
            throw new EntityNotFoundException(self::$faxTypeEntityName, $entry['faxType']['id']);
        } else {
            $fax->setFax($entry['fax']);
            $fax->setFaxType($faxType);
        }

        return $success;
    }
484570
public function setEntity(Entity $entity)
    {
        /** @var SharedEventManager $events */
        $events = $this->getContainer()->get('sharedEventManager');
        $name = $entity->getClassName();
        $events->attach(
            $name,
            Delete::BEFORE_DELETE,
            [$this, 'beforeDelete']
        );
        $events->attach(
            $name,
            Save::AFTER_SAVE,
            [$this, 'afterSave']
        );
        $this->getContainer()->set('sharedEventManager', $events);
        return parent::setEntity($entity);
    }
989942
public function setFax($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->fax !== $v) {
            $this->fax = $v;
            $this->modifiedColumns[] = CustomerPeer::FAX;
        }


        return $this;
    }
119045
public function setData($entity)
    {
        if ($this->accessor == null) {
            $this->accessor = new PropertyAccessor;
        }

        foreach ($this->getFields() as $field) {
            if (is_object($field)) {
                if (($mapping = $field->getMappingName()) && !$field->readOnly()) {
                    if (is_array($entity)) {
                        if (isset($entity[$mapping])) {
                            $field->setValue($entity[$mapping], 1);
                        }
                    } else {
                        $value = $this->accessor->getValue($entity, $mapping);
                        $field->setValue($value, 1);
                    }
                }
            }
        }
    }
1170886
public function deleteAddresses($entity)
    {
        // clear addresses
        if ($entity->getAccountAddresses()) {
            foreach ($entity->getAccountAddresses() as $accountAddresses) {
                $this->em->remove($accountAddresses->getAddress());
                $this->em->remove($accountAddresses);
            }
        }
    }
867544
public function addFax(\Sulu\Bundle\ContactBundle\Entity\Fax $faxes)
    {
        $this->faxes[] = $faxes;

        return $this;
    }
26294
public function validate(EntityInterface $entity)
    {
        if (!$entity instanceof User) {
            throw new Exception(
                sprintf('The Entity to validate must be an instance of %s', User::class)
            );
        }

        $this->validateUserName($entity->getUserName());
        $this->validateFirstName($entity->getFirstName());
        $this->validateLastName($entity->getLastName());
        $this->validateEmail($entity->getEmail());
        $this->validateCreatedAt($entity->getCreatedAt());
        $this->validatePassword($entity->getPassword());
        $this->validateStatus($entity->getStatus());
        $this->validateRegisterToken($entity->getStatus());
        $this->validateAvatarUrl($entity->getAvatarUrl());
        $this->validateAvatarUrl($entity->getMiniAvatarUrl());
        $this->validateLanguage($entity->getLanguage());
        $errors = $this->getErrors();

        return empty($errors);
    }
461
public function addFaxe(\Sulu\Bundle\ContactBundle\Entity\Fax $faxes)
    {
        $this->faxes[] = $faxes;

        return $this;
    }
117486
private function buildEntityInjectMethodsForEntity(EntityInterface $entity): void
    {
        $reflection = $entity::getDoctrineStaticMeta()->getReflectionClass();
        $entityFqn  = $this->leadingSlash($reflection->getName());
        if (array_key_exists($entityFqn, $this->entityInjectMethods)) {
            return;
        }
        $this->entityInjectMethods[$entityFqn] = [
            self::TYPE_KEY_INSTANCE => [],
            self::TYPE_KEY_STATIC   => [],
        ];

        $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            if (!\ts\stringStartsWith($method->getName(), self::INJECT_DEPENDENCY_METHOD_PREFIX)) {
                continue;
            }
            $typeKey = $method->isStatic() ? self::TYPE_KEY_STATIC : self::TYPE_KEY_INSTANCE;

            $this->entityInjectMethods[$entityFqn][$typeKey][$method->getName()] =
                $this->getDependencyForInjectMethod($method);
        }
    }
379099
public function touch(EntityInterface $entity): void
  { 
    $this->logger->info("Touching %s", $entity->id()->toString());
    $this->database->set(
        (string) $entity->id(), serialize($entity)
    );
    $this->logger->info("Indexing %s", $entity->id()->toString());
    $arr = $entity->toArray();
    $this->events->emit("graphsystem.touched", [$arr]);
    //$this->index->index($entity);
  }
791540
private function handleEntity($entity)
    {
        if (null !== $page = $this->findRelatedPage($entity)) {
            if (null === $page->getId()) {
                return;
            }
            if (!$this->pages->contains($page)) {
                $this->pages->add($page);
            }
        }
    }
673937
protected function setRoot(Entity_Interface $entity)
  {
    if (!$entity->file_exists() || !$entity->is_dir()) {
      throw new Wrapper_FS_Exception(
        "Root folder is not valid"
      );
    }

    $this->_root = $entity;
  }
127861
public function setRelated($alias, Model $entity) {
        $foundRelation = $this->getRelationship($alias);
        if($foundRelation instanceof CustomRelationship) {
            call_user_func(array($this, 'set' . ucfirst($alias)), $entity);
        } else {
            $attribute = $foundRelation->getFields();
            $value = $foundRelation->getReferencedFields();
            if(is_array($attribute)) {
                $count = sizeOf($attribute);
                for($i = 0; $i < $count; $i++) {
                    $this->writeAttribute($attribute[$i], $entity->readAttribute($value[$i]));
                }
            } else {
                $this->writeAttribute($attribute, $entity->readAttribute($value));
            }
        }
    }
1096037
private function setParent($parentData, AccountInterface $account)
    {
        if (null != $parentData && isset($parentData['id']) && 'null' != $parentData['id'] && '' != $parentData['id']) {
            $parent = $this->getRepository()->findAccountById($parentData['id']);
            if (!$parent) {
                throw new EntityNotFoundException($this->getAccountEntityName(), $parentData['id']);
            }
            $account->setParent($parent);
        } else {
            $account->setParent(null);
        }
    }
1280908
public function setMainEmail($entity)
    {
        // set main to first entry or to null
        if ($entity->getEmails()->isEmpty()) {
            $entity->setMainEmail(null);
        } else {
            $entity->setMainEmail($entity->getEmails()->first()->getEmail());
        }
    }
1223725
protected function afterSave(EntityInterface $entity): void
    {
        $argv = compact('entity');
        $argv = $this->getEventManager()->prepareArgs($argv);

        $this->getEventManager()->trigger("{$this->event_prefix}_save_after", $this, $argv);
        if ($this->entity_event_prefix) {
            $this->getEventManager()->trigger("{$this->entity_event_prefix}_save_after", $this, $argv);
        }
    }