Skip to content

Commit

Permalink
When serializing a Route, don't serialize the compiled route.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Jul 10, 2012
1 parent 5f6a17b commit a6d44bd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Symfony/Component/Routing/Route.php
Expand Up @@ -18,7 +18,7 @@
*
* @api
*/
class Route
class Route implements \Serializable
{
private $pattern;
private $defaults;
Expand Down Expand Up @@ -55,6 +55,25 @@ public function __clone()
$this->compiled = null;
}

public function serialize()
{
return serialize(array(
'pattern' => $this->pattern,
'default' => $this->default,
'requirements' => $this->requirements,
'options' => $this->options,
));
}

public function unserialize($data)
{
$data = unserialize($data);
$this->pattern = $data['pattern'];
$this->default = $data['default'];
$this->requirements = $data['requirements'];
$this->options = $data['options'];
}

/**
* Returns the pattern.
*
Expand Down

0 comments on commit a6d44bd

Please sign in to comment.