Author: xavier
Date: 2010-05-19 22:44:48 +0200 (Wed, 19 May 2010)
New Revision: 29537
Modified:
plugins/sfDoctrineShortUrlPlugin/trunk/lib/model/doctrine/PluginsfShortUrlTable.class.php
Log:
[sfDoctrineShortUrlPlugin]: fixed a bug that made the plugin generate a new
shorturl each time the user request an already taken alias
Modified:
plugins/sfDoctrineShortUrlPlugin/trunk/lib/model/doctrine/PluginsfShortUrlTable.class.php
===================================================================
---
plugins/sfDoctrineShortUrlPlugin/trunk/lib/model/doctrine/PluginsfShortUrlTable.class.php
2010-05-19 20:36:14 UTC (rev 29536)
+++
plugins/sfDoctrineShortUrlPlugin/trunk/lib/model/doctrine/PluginsfShortUrlTable.class.php
2010-05-19 20:44:48 UTC (rev 29537)
@@ -35,13 +35,8 @@
public function generate($longurl, $shorturl = '')
{
- if ('' == $shorturl)
+ if ($shorturl)
{
- // try to retrieve a corresponding url within the public ones
- $shorturl_object = $this->findOneByLongurl($longurl);
- }
- else
- {
// try to retrieve a corresponding couple (shorturl, longurl)
$objects = Doctrine_Query::create()
->from('sfShortUrl u')
@@ -51,6 +46,12 @@
$shorturl_object = isset($objects[0]) ? $objects[0] : null;
}
+ if ('' == $shorturl || !isset($shorturl_object) || !$shorturl_object)
+ {
+ // try to retrieve a corresponding url within the public ones
+ $shorturl_object = $this->findOneByLongurl($longurl);
+ }
+
if (!isset($shorturl_object) || !$shorturl_object)
{
// no acceptable object => create one
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.