Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Setting model state in the new MVC classes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rune V. Sjøen  
View profile  
 More options Jul 25 2012, 10:03 am
From: Rune V. Sjøen <rvsj...@gmail.com>
Date: Wed, 25 Jul 2012 07:03:32 -0700 (PDT)
Local: Wed, Jul 25 2012 10:03 am
Subject: Setting model state in the new MVC classes

Hello all,

I was poking around the new MVC classes and apparently the setState() of
JModel now only supports a JRegistry object as an argument. Not only that,
it does not support "merging" another registry object to append keys to the
state.

In the old MVC the controller has been able to set/modify state values in
the model by calling setState() with two parameters (key/value), this is no
longer possible and would result in the controller having to 1. get the
registry object, 2. set the value, 3. set the registry object back in the
model to be able to do this.

So to sum it all up, I have two questions.

1. Is there a particular reason why the setState() function can't support
both setting a new JRegistry object, and setting a new value in the
registry object based on a key/value pair?

2. While I do get that type hinting is the new cool stuff in the platform,
does it make sense to force the object type in this case , thus making the
implementation less flexible for people that want to use the JModel
interface ?

Cheers,
Rune


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Louis Landry  
View profile   Translate to Translated (View Original)
 More options Jul 25 2012, 10:52 am
From: Louis Landry <louislan...@gmail.com>
Date: Wed, 25 Jul 2012 07:52:36 -0700
Local: Wed, Jul 25 2012 10:52 am
Subject: Re: [jplatform] Setting model state in the new MVC classes
I've been struggling with the same things Rune. It may have simply been a case of over zealous simplification.

L

Sent from my iPad

On Jul 25, 2012, at 7:03 AM, Rune V. Sjøen <rvsj...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rune V. Sjøen  
View profile  
 More options Jul 25 2012, 12:04 pm
From: Rune V. Sjøen <rvsj...@gmail.com>
Date: Wed, 25 Jul 2012 09:04:21 -0700 (PDT)
Local: Wed, Jul 25 2012 12:04 pm
Subject: Re: [jplatform] Setting model state in the new MVC classes

Personally I would probably prefer something like this

        public function setState($name, $value = null)
        {
                if($name instanceof JRegistry)
                {
                        $this->state->merge($name);
                }
                else
                {
                        $this->state->set($name, $value);
                }
        }

But that does create an ambiguous argument name since the first argument
can both be a path and an object. With maybe an optional argument whether
to merge or just replace the whole registry object. Quite possibly it would
be better to implement two methods in the interface. And of course their
getters respectively.

public function setState($name, $value);
public function setStore(JRegistry $object);

This would allow proper type hinting where needed, and make the behavior
consistent to what a lot of software already out there expects, being able
to set values in the state using setState()

- Rune


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Louis Landry  
View profile  
 More options Oct 9 2012, 2:47 am
From: Louis Landry <louislan...@gmail.com>
Date: Mon, 8 Oct 2012 23:47:20 -0700
Local: Tues, Oct 9 2012 2:47 am
Subject: Re: [jplatform] Setting model state in the new MVC classes

That's actually not a bad idea Rune.  I'd like to hear what others think on
this.  It may be just as easy if you are willing to just put together a
quick pull request for the basics here and we can discuss the details in
the PR discussion thread.  Whatever works for you.

Cheers.

- Louis

On Wed, Jul 25, 2012 at 9:04 AM, Rune V. Sjøen <rvsj...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Eddie  
View profile  
 More options Oct 9 2012, 3:28 am
From: Andrew Eddie <mambob...@gmail.com>
Date: Tue, 9 Oct 2012 17:28:06 +1000
Local: Tues, Oct 9 2012 3:28 am
Subject: Re: [jplatform] Setting model state in the new MVC classes
Just thinking out loud.

On 26 July 2012 02:04, Rune V. Sjøen <rvsj...@gmail.com> wrote:

> public function setState($name, $value);
> public function setStore(JRegistry $object);

public function setState($name, $value);

public function putState(JRegistry $object); // ??
// or
public function loadState(JRegistry $object); // ??

We use the "load*" in other places for dependancy injection in the
application object.

Regards,
Andrew Eddie
http://learn.theartofjoomla.com - training videos for Joomla developers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Emerson da Rocha Luiz  
View profile  
 More options Oct 9 2012, 7:42 am
From: Emerson da Rocha Luiz <emer...@webdesign.eng.br>
Date: Tue, 9 Oct 2012 08:42:12 -0300
Local: Tues, Oct 9 2012 7:42 am
Subject: Re: [jplatform] Setting model state in the new MVC classes

Be able to merge states again, on the new MVC, is a good idea. I just do
not have a strong opinion about names of new or old  methods to do it.

att. Emerson

/android
Em 25/07/2012 13:04, "Rune V. Sjøen" <rvsj...@gmail.com> escreveu:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
goldenmean  
View profile  
 More options Oct 11 2012, 11:56 am
From: goldenmean <alonzo.tur...@subtextproductions.com>
Date: Thu, 11 Oct 2012 08:56:54 -0700 (PDT)
Local: Thurs, Oct 11 2012 11:56 am
Subject: Re: Setting model state in the new MVC classes

I prefer Andrew's nomenclature. To me it is more readily apparent how the
different methods are to be used, and I like that "State" is consistent
across the method names.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »