Запускает транзакцию по изменению последней части ЧПУ объекта.
@param IHierarchicObject $object изменяемый объект
@param $newSlug $slug последняя часть ЧПУ
@throws RuntimeException если невозможно изменить объект
163157
protected function persistChangedSlug(IHierarchicObject $object, $newSlug)
    {

        $affectedDriver = $this
            ->getMetadata()
            ->getCollectionDataSource()
            ->getMasterServer()
            ->getConnection();

        $this
            ->getObjectPersister()
            ->executeTransaction(
                function () use ($object, $newSlug) {

                    $this->checkIfChangeSlugPossible($object, $this, $newSlug);
                    $this
                        ->buildUpdateUrlQuery($object, $this, $newSlug)
                        ->execute();

                },
                [$affectedDriver]
            );
    }
961455
function storeSlug($slug,$title){
        if($slug!='')
            $slug= $this->str_slug($slug);
        else
            $slug= $this->str_slug($title);

        return $this->checkSlugInCategories($slug);
    }
847152
public function setObjectSlug($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->object_slug !== $v) {
            $this->object_slug = $v;
            $this->modifiedColumns[SportTableMap::COL_OBJECT_SLUG] = true;
        }

        return $this;
    }
145193
public function execute($object)
    {
        $callable = array($object, $this->methodName);

        if (!is_callable($callable)) {
            $className = get_class($object);

            throw new RuntimeException("Method '$this->methodName' does not exist in object of class '$className'");
        }

        return call_user_func_array($callable, $this->params);
    }
1051639
public function insertLog($idObject="",$objJson="",$idFunzione="",$dettagli=""){

        //Creo una nuova istanza di log
        $intranetLogApp = new IntranetLogApp();

        $intranetLogApp->setDettagli($dettagli);
        if (!empty($idFunzione)) {
            $repository = $this->em->getRepository('retItaliaAuthenticationBundle:SaFunzione');
            $saFunzione=$repository->find($idFunzione);
            if (!empty($saFunzione)) {
                $intranetLogApp->setIdFunzione($saFunzione);
            }
        }
        $intranetLogApp->setIdObject($idObject);
        $intranetLogApp->setObjJson($objJson);

        if (!empty($this->application_id)) {
            $repository = $this->em->getRepository('retItaliaAuthenticationBundle:SaApplicazione');
            $saApplicazione=$repository->find($this->application_id);
            if (!empty($saApplicazione)) {
                $intranetLogApp->setIdApplicazione($saApplicazione);
            }
        }
        $intranetLogApp->setIdUtente($this->tokenStorage->getToken()->getUser());
        $intranetLogApp->setDataLog(new \DateTime());

        //Persisto l'oggetto
        $this->em->persist($intranetLogApp);

        //Flush di tutto
        $this->em->flush();
    }
1368546
public function prepareSlugForPersist($title, $slug, $id=false)
    {
        $separator = '-';

        if ($slug == "")
        {
            // No slug.. so this is a "create" form; or, the slug was deleted accidentally and so needs to be regenerated

            // Convert all dashes/underscores into separator
            $flip = $separator == '-' ? '_' : '-';

            // wash the title
            $title = html_entity_decode($title);
            $title = strip_tags($title);
            $title = filter_var($title, FILTER_SANITIZE_STRING);
            // remove the encoded blank chars
            $title = str_replace("\xc2\xa0",'',$title);
            // remove encoded apostrophe
            $title = str_replace("&#39;",'',$title);
            $title = trim($title);

            $slug = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);

            // Remove all characters that are not the separator, letters, numbers, or whitespace.
            $slug = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($slug));

            // Replace all separator characters and whitespace by a single separator
            $slug = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $slug);

            // well, is another record using this slug already? Let's return a record count, so we can use the count number...
            $rowCount = $this->doesSlugAlreadyExist($slug);

            if ($rowCount > 0)
            {
                // yes, this slug does exist already, so let's append this slug to make it different from what already exists.
                ++$rowCount;
                return $slug.$rowCount;
            }

            // no, this slug does not yet exist, so let's use it as-is...
            return $slug;
        }


        // Ah, so a slug was entered. So coming from an "edit" form...

        // remove the encoded blank chars
        $slug = str_replace("\xc2\xa0",'',$slug);

        // remove encoded apostrophe
        $slug = str_replace("&#39;",'',$slug);

        $slug = trim($slug);
        $slug = strtolower($slug);
        $slug = strip_tags($slug);
        $slug = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $slug);


        // if this slug is a different slug manually entered into the edit form, then process it further
        if (!$this->isManuallyChangedSlugInEditForm($slug, $id)) {
            return $slug;
        }

        // so this slug does belong to the existing ID, but is different than the slug in the database...

        // well, is another record using this slug already? Let's return a record count, so we can use the count number...
        $rowCount = $this->doesSlugAlreadyExist($slug);

        if ($rowCount > 0)
        {
            // yes, this slug does exist already, so let's append this slug to make it different from what already exists.
            ++$rowCount;
            return $slug.$rowCount;
        }

        // no, this slug does not yet exist, so let's use it as-is...
        return $slug;
    }
466462
protected function _conditions($entity, $slug)
    {
        /** @var string $primaryKey */
        $primaryKey = $this->_table->getPrimaryKey();
        $field = $this->_table->aliasField($this->getConfig('field'));

        $conditions = [$field => $slug];

        if (is_callable($this->getConfig('scope'))) {
            $scope = $this->getConfig('scope');
            $conditions += $scope($entity);
        } else {
            $conditions += $this->getConfig('scope');
        }

        if ($id = $entity->{$primaryKey}) {
            $conditions['NOT'][$this->_table->aliasField($primaryKey)] = $id;
        }

        return $conditions;
    }
578995
public function generate($type, $object, $absolute = false, array $extraParams = array())
    {
        if ( ! is_object($object)) {
            throw new \InvalidArgumentException(sprintf('$object must be an object, but got "%s".', gettype($object)));
        }

        /** @var $metadata ClassMetadata */
        $metadata = $this->metadataFactory->getMetadataForClass(get_class($object));
        if (null === $metadata) {
            throw new \RuntimeException(sprintf('There were no object routes defined for class "%s".', get_class($object)));
        }

        if ( ! isset($metadata->routes[$type])) {
            throw new \RuntimeException(sprintf(
                'The object of class "%s" has no route with type "%s". Available types: %s',
                get_class($object),
                $type,
                implode(', ', array_keys($metadata->routes))
            ));
        }

        $route = $metadata->routes[$type];

        $params = $extraParams;
        foreach ($route['params'] as $k => $path) {
            $params[$k] = $this->accessor->getValue($object, $path);
        }

        return $this->router->generate($route['name'], $params, $absolute);
    }
1000516
public function make(string $slug, $objects, string $plural, string $singular): TaxonomyInterface
    {
        $taxonomy = (new Taxonomy($slug, (array) $objects, $this->container, $this->action))
            ->setLabels([
                'name' => $plural,
                'singular_name' => $singular,
                'search_items' => sprintf('Search %s', $plural),
                'popular_items' => sprintf('Popular %s', $plural),
                'all_items' => sprintf('All %s', $plural),
                'parent_item' => sprintf('Parent %s', $singular),
                'parent_item_colon' => sprintf('Parent %s:', $singular),
                'edit_item' => sprintf('Edit %s', $singular),
                'view_item' => sprintf('View %s', $singular),
                'update_item' => sprintf('Update %s', $singular),
                'add_new_item' => sprintf('Add New %s', $singular),
                'new_item_name' => sprintf('New %s Name', $singular),
                'separate_items_with_commas' => sprintf('Separate %s with commas', strtolower($plural)),
                'add_or_remove_items' => sprintf('Add or remove %s', strtolower($plural)),
                'choose_from_most_used' => sprintf('Choose from the most used %s', strtolower($plural)),
                'not_found' => sprintf('No %s found', strtolower($plural)),
                'no_terms' => sprintf('No %s', strtolower($plural)),
                'items_list_navigation' => sprintf('%s list navigation', $plural),
                'items_list' => sprintf('%s list', $plural),
                'most_used' => 'Most Used',
                'back_to_items' => sprintf('Back to %s', $plural)
            ])
            ->setArguments([
                'public' => true,
                'show_in_rest' => true,
                'show_admin_column' => true
            ]);

        $abstract = sprintf('themosis.taxonomy.%s', $slug);

        if (! $this->container->bound($abstract)) {
            $this->container->instance($abstract, $taxonomy);
        } else {
            throw new TaxonomyException('The taxonomy ['.$slug.'] already exists.');
        }

        return $taxonomy;
    }
816225
public function generateBlockStorage($object, $isPrimaryKey = false)
    {
        $vendorSpecific = $object->getVendorInfoForType('oracle');
        if ($vendorSpecific->isEmpty()) {
            return '';
        }

        if ($isPrimaryKey) {
            $physicalParameters = "
USING INDEX
";
            $prefix = "PK";
        } else {
            $physicalParameters = "\n";
            $prefix = "";
        }

        if ($vendorSpecific->hasParameter($prefix . 'PCTFree')) {
            $physicalParameters .= "PCTFREE " . $vendorSpecific->getParameter($prefix . 'PCTFree') . "
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'InitTrans')) {
            $physicalParameters .= "INITRANS " . $vendorSpecific->getParameter($prefix . 'InitTrans') . "
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'MinExtents') || $vendorSpecific->hasParameter($prefix . 'MaxExtents') || $vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
            $physicalParameters .= "STORAGE
(
";
            if ($vendorSpecific->hasParameter($prefix . 'MinExtents')) {
                $physicalParameters .= "	MINEXTENTS " . $vendorSpecific->getParameter($prefix . 'MinExtents') . "
";
            }
            if ($vendorSpecific->hasParameter($prefix . 'MaxExtents')) {
                $physicalParameters .= "	MAXEXTENTS " . $vendorSpecific->getParameter($prefix . 'MaxExtents') . "
";
            }
            if ($vendorSpecific->hasParameter($prefix . 'PCTIncrease')) {
                $physicalParameters .= "	PCTINCREASE " . $vendorSpecific->getParameter($prefix . 'PCTIncrease') . "
";
            }
            $physicalParameters .= ")
";
        }
        if ($vendorSpecific->hasParameter($prefix . 'Tablespace')) {
            $physicalParameters .= "TABLESPACE " . $vendorSpecific->getParameter($prefix . 'Tablespace');
        }

        return $physicalParameters;
    }
206292
function updateSlug($category,$slug,$title){
        if($slug!='')
            $slug= $this->str_slug($slug);
        else
            $slug= $this->str_slug($title);

        if($category->slug==$slug)
            return $slug;
        else
            return $this->checkSlugInCategories($slug);
    }
299582
public function show($slug)
    {
        return collect($this->metrics->snapshotsForJob($slug))->map(function ($record) {
            $record->runtime = round($record->runtime / 1000, 3);
            $record->throughput = (int) $record->throughput;

            return $record;
        });
    }
1079710
protected function doExtract($object)
    {
        $originalFieldNames = $this->metadata->getOriginalFieldNames();

        /*
        $filter = $object instanceof FilterProviderInterface
            ? $object->getFilter()
            : $this->filterComposite;
        */

        $data = [];
        if (! $this->metadata->hasCustomHydrator()) {

            $this->executeMethods($object, $this->metadata->getPreExtractListeners());

            foreach ($originalFieldNames as $originalFieldName) {
                $mappedFieldName = $this->metadata->getMappedFieldName($originalFieldName);

                if ($this->metadata->isNotManaged($mappedFieldName)) {
                    continue;
                }

                if ($this->metadata->isValueObject($mappedFieldName)) {
                    continue;
                }

                /*if ($filter && !$filter->filter($mappedFieldName)) {
                    continue;
                }*/

                try {
                    $value = $this->memberAccessStrategy->getValue($object, $mappedFieldName);             
                } catch (NotFoundMemberException $e) {
                    continue;
                }

                if (null === $value) {
                    $data[$originalFieldName] = null;
                    continue;
                }

                if ($fieldClass = $this->metadata->getClassOfMappedField($mappedFieldName)) {
                    $fieldHydrator = $this->objectManager->createHydratorFor($fieldClass);
                    $fieldValue = $value;

                    /*if (! is_array($fieldValue)) {
                        throw new ObjectMappingException(
                            sprintf(
                                'Cannot hydrate field "%s" of class "%s" from raw data.'
                                . ' Raw data should be an array but got "%s".', 
                                $mappedFieldName,
                                $fieldClass,
                                is_object($fieldValue) ? get_class($fieldValue) : gettype($fieldValue)
                                )
                        );
                    }   */
                    
                    reset($fieldValue);
                    if (0 !== count($fieldValue) && ! is_numeric(key($fieldValue))) {
                        $fieldRawData = $fieldHydrator->extract($fieldValue);
                        $data[$originalFieldName] = $fieldRawData;                              
                    } else {

                        $fieldRawData = [];
                        foreach ($fieldValue as $itemFieldValue) {              
                            $fieldRawData[] = $fieldHydrator->extract($itemFieldValue);                
                        }
                        $data[$originalFieldName] = $fieldRawData;
                    }   
                } else {
                    $value = $this->extractValue($mappedFieldName, $value, $object, $data);
                    $data[$originalFieldName] = $value;    
                }
            }
        } else {
            list($customHydratorClass, , $customExtractMethod) = $this->metadata->getCustomHydratorInfo();            
            $this->executeMethod($object, new ClassMetadata\Model\Method($customHydratorClass, $customExtractMethod, [$object]));
        }

        //Value objects extraction.
        foreach ($this->metadata->getFieldsWithValueObjects() as $mappedFieldName) {

            if ($this->metadata->isNotManaged($mappedFieldName)) {
                continue;
            }

            $info = $this->metadata->getValueObjectInfo($mappedFieldName);
            list($voClassName, $voResource, $voResourceType) = $info;

            $valueObjectHydrator = $this->objectManager->createHydratorFor($voClassName);
            $objectKey = $this->pushRuntimeConfiguration($mappedFieldName, $object, $voClassName, $voResourceType, $voResource);

            $valueObject = $this->memberAccessStrategy->getValue($object, $mappedFieldName);
            $valueObjectData = $valueObjectHydrator->extract($valueObject, $objectKey);
            $this->popRuntimeConfiguration();

            $data = array_merge($data, $valueObjectData);
        }

        $this->executeMethods($object, $this->metadata->getPostExtractListeners());

        return $data;
    }
1184816
public function resolve($object, array $args, $context, ResolveInfo $info)
    {
        // Get the args
        $id = $args['ID'];
        $rollbackVersion = $args['ToVersion'];

        // Pull the latest version of the record
        /** @var Versioned|DataObject $record */
        $record = Versioned::get_latest_version($this->getDataObjectClass(), $id);

        // Assert permission
        $user = $context['currentUser'];
        if (!$record->canEdit($user)) {
            throw new InvalidArgumentException('Current user does not have permission to roll back this resource');
        }

        // Perform the rollback
        $record = $record->rollbackRecursive($rollbackVersion);

        return $record;
    }
378202
public function save($object, $meta=null)
    {
        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        } else {
            $meta = $this->mapper->getMeta(get_class($object));
        }

        if (!$meta->primary) {
            throw new Exception("No primary key for {$meta->id}");
        }

        $shouldInsert = null;
        $prival = null;
        if ($meta->autoinc) {
            $prival = $meta->getValue($object, $meta->autoinc);
            $shouldInsert = !$prival;
        } else {
            $prival = $meta->getIndexValue($object);
        }

        event_before: {
            if (isset($meta->on['beforeSave'])) {
                foreach ($meta->on['beforeSave'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['beforeSave'])) {
                foreach ($this->on['beforeSave'] as $cb) { $cb($object, $meta); }
            }
        }

        if ($shouldInsert === null) {
            $newpri = $meta->getIndexValue($object);
            $shouldInsert = $newpri != $prival;
        }

        if ($shouldInsert) {
            $this->insert($object, $meta);
        } else {
            $this->update($object, $meta);
        }

        event_after: {
            if (isset($meta->on['afterSave'])) {
                foreach ($meta->on['afterSave'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['afterSave'])) {
                foreach ($this->on['afterSave'] as $cb) { $cb($object, $meta); }
            }
        }
    }
547356
public function log($level, $object, $context = array())
    {
        if (!isset(self::$levels[$level])) {
            throw new \InvalidArgumentException('Invalid log level supplied to function');
        } else if ($this->enabled && $this->writer && $level <= $this->level) {
            $message = (string)$object;
            if (count($context) > 0) {
                if (isset($context['exception']) && $context['exception'] instanceof \Exception) {
                    $message .= ' - ' . $context['exception'];
                    unset($context['exception']);
                }
                $message = $this->interpolate($message, $context);
            }
            return $this->writer->write($message, $level);
        } else {
            return false;
        }
    }
259685
public function setSlug($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->slug !== $v) {
            $this->slug = $v;
            $this->modifiedColumns[SkillVersionTableMap::COL_SLUG] = true;
        }

        return $this;
    }