JaquelineBrandao / yii

Automatically exported from code.google.com/p/yii
0 stars 0 forks source link

Make CUrlManager better extendable #766

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently it's not possible to access CUrlManager::$_rules because it's a
private property. I suggest to make it a protected property or add special
methods in order to access the private property.

The actual problem is for example when passing a fresh array of rules to
CUrlManager::$rules and then call the protected method
CUrlManager::processRules(), the already compiled rules are still active
and working. There should be a way to have access to the already compiled
rules - complex, preloaded components will benefit.

Thanks.

Original issue reported on code.google.com by keyboard...@gmail.com on 29 Dec 2009 at 7:56

GoogleCodeExporter commented 9 years ago
I don't see the needs for cleaning up existing compiled rules. Could you please
elaborate the scenario in which you need this support?

Original comment by qiang.xue on 29 Dec 2009 at 1:36

GoogleCodeExporter commented 9 years ago
As you can see in my other ticket
(http://code.google.com/p/yii/issues/detail?id=767), I have problems generating
independent url's when the route (controller/action) is the same. To solve this
problem in my custom I18n component, I parse out specific rules in order to 
make it
work. See attached file in createUrl() method were I create a new urlManager 
instance
instead of just using Yii::app()->urlMananager. With a protected $_rules 
property I
could just backup the original compiled rules, proccess the temporary rules + 
create
the url and then set back the original compiled rules.

I really think this is an important feature, especially for any preloaded 
component
that has to do with dynamic loading of url rules.

Original comment by keyboard...@gmail.com on 29 Dec 2009 at 7:39

Attachments:

GoogleCodeExporter commented 9 years ago
I just added CUrlManager::createUrlRule(). Now you can write your own url rule 
class
to support more advanced/customized url creation/parsing.

We usually only change private variables to protected or public per user 
request with
sufficient reasons. We may choose to refactor the code, instead, if that works 
better.

Original comment by qiang.xue on 29 Dec 2009 at 7:59

GoogleCodeExporter commented 9 years ago
A good step to make things more extendable. Thanks!

Original comment by keyboard...@gmail.com on 29 Dec 2009 at 8:39

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/yiisoft/yii/issues/37

Original comment by qiang.xue on 15 Feb 2012 at 6:36

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/yiisoft/yii/issues/77

Original comment by qiang.xue on 15 Feb 2012 at 6:45