ServiceLocatorAwareInterface ->Abstract class for GET/SET

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

ServiceLocatorAwareInterface ->Abstract class for GET/SET

ThaDafinser
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin
Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

Marco Pivetta
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin

Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

ThaDafinser
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin


Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

Marco Pivetta
I wouldn't suggest more logic in this direction tbh... Traits are fine for this already



On 23 October 2013 14:13, Martin Keckeis <[hidden email]> wrote:
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin



Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

ThaDafinser
Hello Marco,

my idea is just to reduce the, let's call it "boilerplate code" for services.

Trait would be for sure a better idea, since it's avoid the single class extend possibility.
If i'm the only one wanting this into the ZF2 core, i'll be fine anyway :-)

Just though maybe many people are annoyed by writing this codeblock far to often...



2013/10/23 Marco Pivetta <[hidden email]>
I wouldn't suggest more logic in this direction tbh... Traits are fine for this already
On 23 October 2013 14:13, Martin Keckeis <[hidden email]> wrote:
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin




Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

ThaDafinser
In reply to this post by Marco Pivetta
Traits aren't that good, because they can't implement interfaces -> so we can't use them here.

(sorry for double post)



2013/10/23 Marco Pivetta <[hidden email]>
I wouldn't suggest more logic in this direction tbh... Traits are fine for this already
On 23 October 2013 14:13, Martin Keckeis <[hidden email]> wrote:
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin




Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

jeremiah
The class they are used in can implement an interface via traits. I think using a trait for this is better than blocking the extend.

Plus there is already \Zend\ServiceManager\ServiceLocatorAwareTrait

Jeremiah

On Oct 23, 2013, at 7:17 AM, Martin Keckeis <[hidden email]> wrote:

Traits aren't that good, because they can't implement interfaces -> so we can't use them here.

(sorry for double post)



2013/10/23 Marco Pivetta <[hidden email]>
I wouldn't suggest more logic in this direction tbh... Traits are fine for this already
On 23 October 2013 14:13, Martin Keckeis <[hidden email]> wrote:
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin




Reply | Threaded
Open this post in threaded view
|

Re: ServiceLocatorAwareInterface ->Abstract class for GET/SET

ThaDafinser
Okay i completely overlooked the trait...my fault.
(Never saw that anywhere implmeneted, and looped through the ServiceManager directory to fastly)

So i'm completely fine with that!


2013/10/23 Jeremiah Small <[hidden email]>
The class they are used in can implement an interface via traits. I think using a trait for this is better than blocking the extend.

Plus there is already \Zend\ServiceManager\ServiceLocatorAwareTrait

Jeremiah

On Oct 23, 2013, at 7:17 AM, Martin Keckeis <[hidden email]> wrote:

Traits aren't that good, because they can't implement interfaces -> so we can't use them here.

(sorry for double post)



2013/10/23 Marco Pivetta <[hidden email]>
I wouldn't suggest more logic in this direction tbh... Traits are fine for this already
On 23 October 2013 14:13, Martin Keckeis <[hidden email]> wrote:
Hello,

forgott the gist, sorry


2013/10/23 Marco Pivetta <[hidden email]>
I suggest making a PR with the pseudo-code first. Explaining code in words looks just more troublesome :-)



On 23 October 2013 14:06, Martin Keckeis <[hidden email]> wrote:
Hello together,

since i wrote last time a lot of services, the ServiceLocatorAwareInterface stuff taking too much time (if not using a template or something else):
* 2 use statements
* property
* get / set method

I would like to write an abstract class for this,
But before submitting a PR -> what do you think about this?


Best regards
Martin