Feature #1789

Routing: Implement automatic UUID to object conversion

Added by Bastian Waidelich almost 7 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2008-10-23
Priority:Must have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:MVC
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 1
PHP Version: Complexity:
Has patch:

Description

Fluid already converts objects used as arguments for URIs (in forms and action links) to uuids and if no custom route is specified, the router adds them as regular GET parameters:

http://myhost/foo/bar?baz=297f1954-3904-4824-94c9-3b66d46f2e74

In the example above "baz" is an controller argument of some object type which has been converted to its uuid by Fluid. What we need now is the counterpart which transparently converts the uuid into an object.

Associated revisions

Revision 27e159ab
Added by Robert Lemke about 6 years ago

Bug fixes during the TYPO3 Bugday on T3DD09

  • FLOW3: (MVC) Added typehint to AbstractView / ViewInterface setControllerContext()
  • FLOW3: (MVC) Removed the resolving of an object's identity from the Dynamic Route Part handler. This needs to be implemented in a specialized, dedicated route part handler. Refs #1789
  • FLOW3: (MVC) A Route now converts route values which are objects into their uuid.
  • FLOW3: (MVC) Fixed a typo in the Router which cause a fatal error (sometimes). setRoutePartConfigurations()
  • FLOW3: (MVC) Adapted the tests for the DynamicRoutePart handler

Revision 3c0bbcb2
Added by Robert Lemke about 6 years ago

  • FLOW3: (MVC) Implemented automatic conversion of UUIDs into objects retrieved from a repository in the Abstract Controller. This is the counterpart to the object to UUID conversion in the Fluid view helpers. Resolves #1789
  • FLOW3: (MVC) !!! Renamed the recently introduced methods queueFlashMessage() and getFlashMessages() to pushFlashMessage() and popFlashMessages() respectively.

History

#1 Updated by Karsten Dambekalns almost 7 years ago

  • Priority changed from Should have to Must have
  • Target version set to 1.0 alpha 1

#2 Updated by Robert Lemke about 6 years ago

Some code snippets from T3DD09:

if (strlen($value) === 36 && preg_match('/([a-f0-9]){8}-([a-f0-9]){4}-([a-f0-9]){4}-([a-f0-9]){4}-([a-f0-9]){12}/', $value)) {
    $query = $this->queryFactory->create('F3\Blog\Domain\Model\Blog');
    $objects = $query->matching($query->withUUID($value))->execute();
    if (count($objects) !== 1 ) return FALSE;
    $value = current($objects);
}

final public function resolve(array &$routeValues) {
    $this->value = NULL;
    if ($this->name === NULL || $this->name === '') {
        return FALSE;
    }
    $valueToResolve = $this->findValueToResolve($routeValues);
    if (is_object($valueToResolve)) {
        $valueToResolve = $this->persistenceManager->getBackend()->getUUIDByObject($valueToResolve);
    }
    if (!$this->resolveValue($valueToResolve)) {
        return FALSE;
    }
    unset($routeValues[$this->name]);
    return TRUE;
}

#3 Updated by Robert Lemke about 6 years ago

  • Assigned To changed from Bastian Waidelich to Robert Lemke

#4 Updated by Robert Lemke about 6 years ago

  • Status changed from New to Accepted

#5 Updated by Robert Lemke about 6 years ago

  • Subject changed from Routing: RoutePartHandler Service to Routing: Implement automatic UUID to object conversion

#6 Updated by Robert Lemke about 6 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2371.

Also available in: Atom PDF