Re: [fw-general] about list

2017-01-30 Thread Marco Pivetta
It's still working, but moderation is kinda meh, so there's loads of spam
posts by bots :-(

I would suggest posting questions directly on Github for easier
cross-referencing and discoverability.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Mon, Jan 30, 2017 at 3:01 PM, Sergio Gabriel Rodriguez <
sgrodrig...@gmail.com> wrote:

> Hi, is this list still working?
>
> Sergio.
>


[fw-general] Re: as I can create a wrapper in zend2?

2016-02-23 Thread Marco Pivetta
Heya,

You don't need any wrapper for an API: just write a factory for the service
and use it :-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 22 February 2016 at 16:04, losorio30 [via Zend Framework Community] <
ml-node+s634137n4662846...@n4.nabble.com> wrote:

> Hi guys, as I can create a wrapper to use MailChimp api v3 ?, in my
> project zend2
> https://github.com/drewm/mailchimp-api
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/as-I-can-create-a-wrapper-in-zend2-tp4662846.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/as-I-can-create-a-wrapper-in-zend2-tp4662846p4662853.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] php-ZendFramework-extras-1.12.17

2016-02-19 Thread Marco Pivetta
Remi's repository is Remi's repository, not Zendframework's :-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 19 February 2016 at 09:25,  wrote:

> Hello.
>
> I would like to install a set of php-ZendFramework 1.12.17 from remi
> repository,
> but I found php-ZendFramework-extras-1.12.17 is not in repository .
>
> Remi's administrator says "This have be removed from official archive by
> upstream.".
>
> Can I know the reason above ?
>
> I hope you will be able to provide the information.
>
>
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] Re: pass array variable to library/data.php

2016-01-29 Thread Marco Pivetta
What is library/data.php?
On Jan 29, 2016 6:08 AM, "pfalllay [via Zend Framework Community]" <
ml-node+s634137n4662830...@n4.nabble.com> wrote:

> i am newbie in zend.how to pass array variable to library/data.php?
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/pass-array-variable-to-library-data-php-tp4662830.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/pass-array-variable-to-library-data-php-tp4662830p4662831.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Error & Exception Handling in Expressive

2016-01-24 Thread Marco Pivetta
On 24 January 2016 at 12:41, James Abbott  wrote:

> Hi Marco,
>
> Thanks for your response. Good to know that the final handler is the right
> way to go.
>
> I'm not clear on why inheritance would be an invalid solution in this case
> though. Isn't it specifically intended for extending the functionality of a
> class in a scenario like this (where one class is a definite subtype of
> another and you want to reuse some of the parent classes' functionality)?
>

That's a misconception of how `extends` is used: inheritance is a mean to
express different sub-concepts, not really a code-reuse mechanism.


> Alternatively composition via an error handler interface in place of the
> handleErrors() method could be used. Both would provide more flexibility
> than locking down the whole class with private methods.
>

The class can really just be copied into your namespace and adapted to your
needs: It is ~300LOC, mostly comments tho (much lower CLOC).

It can be split into multiple collaborators (each of them being one of the
private methods, pretty much), but the benefits for the framework per-se
are minimal. I suggest simply moving it into your codebase as a first
attempt, and abstract only when there is solid ground for doing so.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Error & Exception Handling in Expressive

2016-01-21 Thread Marco Pivetta
Heya,


On 21 January 2016 at 11:28, James Abbott  wrote:

> I was just wondering why the existing Zend\Stratigility\FinalHandler has so
> many of its methods declared private though? It seems to me that extending
> its behaviour is a valid use case and works well as a means to customise
> error handling. But looking at the method signatures you wouldn't think it
> was encouraged.
>

Inheritance is not the right way to add "your own flavor" to an existing
behavior. The final handler is just a `function ($request, $response,
$error = null);` callable: implementing your own is the way to go ;-)

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Can we disable escapers for html attributes?

2016-01-18 Thread Marco Pivetta
On 18 January 2016 at 12:21, Juan Pedro Gonzalez 
wrote:

This:


> inside the contact controller you could add the code to set the htmlTag
> attributte to show it is a contact page...
>

First of all, why is the controller dealing with presentation logic?


> The other way around this issue that I can think of would be having a
> layout per itemtype and that wouldn't solve the issue as the itemtype could
> go in the htmlTag or any other tag inside the page... So there should also
> be partials all around to define every single piece of microdata. That
> would be almost as having a bunch of static pages and not using MVC at all.
>

Or... just allow the escaper to do its work, and that's it?


> Writing custom view helpers to allow the microdata for schema.org would
> imply writting  copy of almost every viewhelper  extending HtmlElement.
>

Correct, and you are not supposed to do that anyway, since the escaping
provided follows sane and secure defaults


> I undestand that non-escaped string could cause XSS attacks if some user
> provided data is added to the attribute string ¿Am I mistaken?
>

This is correct, but in security there is no "may". If an attack is
possible, it NEEDS to be fixed, period. There is no such thing as "opting
into security" (or even worse "opting out of security"), that is a suicide,
from a developer perspective, and it also really is the quickest way to end
your current employment contract (if you're responsible for the decision).


> Then why not allow the developper to escape data on those cases?
>

Hoping that developers will escape data everywhere is great, but not a
realistic expectation: that's why sane defaults are provided, and opting
out (see answer right above) is something that we (zf developers) don't
want to provide, as it is just dangerous and reckless.


> In this case it seems like a decision between SEO vs Security and assuming
> the developper won't take care of security he gets SEO crippled as some
> microdata test will go through on some search engines but not in others. I
> thinks thats assuming a decision over the developper.
>

Again: stop saying that this will damage SEO. If yandex has broken
validation, then mail them and tell them to fix their shit (not kidding,
this looks really bad!). Any DOM compliant parser will transparently deal
with un-escaping content at parse time without any issues at all.

>
> I guess it should be optional, maybe something like:
> public function addAttribute($name, $value, $escape=true)
>

ABSOLUTELY NOT. We value security, and not escaping strings in any data
that will (on the consumer side) go through an HTML/CSS/JS/XML parser is an
edge case that indicates broken user agents. You are fixing the symptom,
not the cause, and by doing so, you are even introducing security issues
(see ZF2014-03, as linked above). Allowing unescaped output is not
something that ZF should take into consideration, and re-implementing the
view helpers in your own namespace (without involving the framework) is
indeed the way to go, if you want to hurt your own security context.

Security is an all-or-nothing scenario: it defeats any business
requirements, regardless which ones.


> ...but allowing to have non-escaped strings in the attributes. or even a
> general configuration key to disable escaping attributes and leave it
> active by default but being able to disable it if you don't wish to use it.
>

 There is no "wish to use it" - security is not a decision.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 18 January 2016 at 12:21, Juan Pedro Gonzalez 
wrote:

> The microdata for schema.org should be set by the developper or some code
> in the system using Zend Framework. For example, if someone is creating a
> blog module you could add the itemtype as BlogArticle. If it is a contact
> page (Like my example) inside the contact controller you could add the code
> to set the htmlTag attributte to show it is a contact page... The other way
> around this issue that I can think of would be having a layout per itemtype
> and that wouldn't solve the issue as the itemtype could go in the htmlTag
> or any other tag inside the page... So there should also be partials all
> around to define every single piece of microdata. That would be almost as
> having a bunch of static pages and not using MVC at all.
>
> Writing custom view helpers to allow the microdata for schema.org would
> imply writting  copy of almost every viewhelper  extending HtmlElement. I
> undestand that non-escaped string could cause XSS attacks if some user
> provided data is added to the attribute string ¿Am I mistaken?  Then why
> not allow the developper to escape d

Re: [fw-general] Can we disable escapers for html attributes?

2016-01-18 Thread Marco Pivetta
On 18 January 2016 at 11:08, Juan Pedro Gonzalez 
wrote:

> By the way, there IS a problema from a SEO perspective. Using yandex
> microdata validator I get an error with the escaped string:
> "WARNING: itemtype http://schema.org/ContactPage not recognized by
> validator"
> There is no error if the itemtype is NOT escaped. Don't know if other
> search engines will react this way but yandex will certainly have troubles
> with that escaped string and, therefore, Zend Framework will ruin the SEO.
> :(
>

This actually indicates that yandex microdata validator is not DOM
compliant, and may even be vulnerable to XSS injections (OUCH!) when
re-generating output from user input (can't verify it though, as I don't
have a pentesting tool at hand).

I suggest that you look at http://r12a.github.io/apps/conversion/ to check
that the escaping matches your data, if that's what you fear.

Also see https://jsfiddle.net/5toL1c5r/ (proper escaping)
Also see https://3v4l.org/PE8hk (proper parsing via DOM compliant APIs)

Hope that helps

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Can we disable escapers for html attributes?

2016-01-18 Thread Marco Pivetta
On 18 January 2016 at 10:12, Juan Pedro Gonzalez [via Zend Framework
Community]  wrote:

> I don't understand the impact of having some non-escaped attributes.


That is indeed why security experts worked on this (specifically, we fixed
this in 2014: http://framework.zend.com/security/advisory/ZF2014-03 ).


> For example, the "url" view helper won't escape the "href" tag, however
> the "navigation" helper (More preciselly the "menu" plugin inside that view
> helper) will escape the "href" tag.


This is a valid point, and we should probably secure this endpoint as well
(adding escaping).
Please see http://framework.zend.com/security/, or else I'll try inspecting
if it is an immediate attack vector. Further discussion about this
shouldn't be continued on the public mailing list though.


> The "itemtype" attribute of for schema.org is simply an absoulte url and
> it gets escaped...


An absolute URL provided by whom? The navigation view helpers don't know
that.


> I may understand someone will wnt to escape the translated texts inside
> the "alt" atrribute, or something like that, but also not to escape some
> other attributes... Even the class names inside the "menu" plugin of the
> "navigtion" view helper get escaped. If the browser is homebrewed and
> hasn't taken care of it the output may get ruined.
>

The navigation component HAS to treat anything like user input, since it is
a general purpose component.


> IMHO a framework should be so much involved on the output as it seems hard
> to sutomize this issue.


Disagree: ZF2 is quite disengaged on this as well, as the escaping is
usually added by users, unless they use our own internal helpers.


> If I'm not mistaken, in order to get non-escaped attributes I should write
> my own view helpers...


Unescaped attributes must be ABSOLUTELY avoided unless the output data is
not dynamically defined.


> As the MVC module will load the Zend\View View Helpers that means that in
> order to lower the resource I should also avoid using the Zend\Mvc
> namespace or, atleast change all the files under Zend\Mvc\Services to use
> my own so it will load my own application with my own services and, this
> way loading my custom ViewHelpers without loading Zend's. ¡That's a hell of
>  task! But if I wish to maintain control over my output there seems to be
> no other solution. Atleast sticking to Zend Framework.
> I really don't understand the reason to enforce attribute escaping.


I repeat: that's why this is done by security experts (that understand the
domain of security and escaping), and not by general users.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Can we disable escapers for html attributes?

2016-01-18 Thread Marco Pivetta
There is no problem (from an SEO perspective) in having escaped attributes.

Also, UTF-8 is big and scary: don't disable escaping, it's just like asking
for trouble ;-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 18 January 2016 at 07:51, Juan Pedro Gonzalez 
wrote:

> Hi,
> I'm trying to add some schema.org for SEO but the attributes get escaped
> giving an ugly view of the code; further more, I'm not sure search engines
> will be able to handle this data the correct way. ¿Can't it be disabled?
>


Re: [fw-general] ZendFramework-1.12.13-minimal yealds deleted files in search results

2016-01-16 Thread Marco Pivetta
I am a bit confused by the original question:

 * what are we talking about? (link to code/documentation relevant to your
question)
 * what do you expect ZendFramework 1.x to do?
 * what is it doing instead?

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 15 January 2016 at 13:46, Mr.Learner  wrote:

> The php based site uses "ZendFramework-1.12.13-minimal" for search
> functionality. The search results yield the pages which are not available
> in
> the code. Is this issue due to any caching in ZendFramework-1.12.13-minimal
> as the site underwent changes and any solutions to overcome this? Someone
> suggested to rebuild the indexing, however the article is not clear as I'm
> not a developer. I tried replacing the entire
> "ZendFramework-1.12.13-minimal" with a fresh copy and it did not make any
> difference. Is this an issue with Zend or the site php code? Any help on
> this would be really grateful.
>
> Regards,
> Raj.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZendFramework-1-12-13-minimal-yealds-deleted-files-in-search-results-tp4662807.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] Re: How to use ZendOptimizer

2015-11-18 Thread Marco Pivetta
You may want to read about OpCache:

 -
https://tideways.io/profiler/blog/fine-tune-your-opcache-configuration-to-avoid-caching-suprises
 -
https://tideways.io/profiler/blog/dodge-the-thundering-herd-with-file-based-opcache-in-php7

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 18 November 2015 at 11:42, sreejith_y [via Zend Framework Community] <
ml-node+s634137n466272...@n4.nabble.com> wrote:

> Hi,
>
> How to use "ZendOptimizer" to improve the php performance? is it only
> enabling opcode caching?
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/How-to-use-ZendOptimizer-tp4662722.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-use-ZendOptimizer-tp4662722p4662723.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Zend 2 Application - Issue with concurrent user access

2015-10-25 Thread Marco Pivetta
This seems to be a typical scalability issue.
Unlikely a problem with the framework: you are just reaching the limit of
active users for the deployment configuration you have: you should scale it
up.

Scaling is not linear: the more users, the more memory/cpu/io is going on,
and if you reach the cap for any of those on any of the machines, it chokes
and gets to a grinding halt (typically dropping connections or being very
very slow).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 19 October 2015 at 13:01, sreejith_y [via Zend Framework Community] <
ml-node+s634137n4662707...@n4.nabble.com> wrote:

> Hi,
>
> While trying to do performance testing, the zend 2 web application ( back
> end servers: aws core 32 instances with ELB), the application works for
> 1500 concurrent users with 3 second interval.
>
> But when tried with 2000 users, many requests failed. Is this an issue
> with the Framework
>
> Can anyone help? can anyone suggest the apache settings for these many
> concurrent users
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Zend-2-Application-Issue-with-concurrent-user-access-tp4662707.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-2-Application-Issue-with-concurrent-user-access-tp4662707p4662712.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] ZF3 release date

2015-10-21 Thread Marco Pivetta
Hi Ralf,

I don't think there is a scheduled release atm.
ServiceManager and EventManager v3 are being finalized though, and various
components are being upgraded to consume those versions.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 20 October 2015 at 22:45, Ralf Eggert  wrote:

> Hi,
>
> since I wasn't in Las Vegas yesterday, I could not attend the ZendCon
> keynote from Andi and Zeev. I tried to follow the Twitter messages and I
> notices that ZF3 and Zend\Expressive was mentioned as well.
> Zend\Expressive was officially announced yesterday which is really,
> reelly great news! I also tried to find an official release date for the
> ZF3. In January 2015 the release was planned for Q3/2015.
>
> Have Andi or Zeev mentioned a release date yesterday? Maybe anyone
> attending yesterday heard of it?
>
> Thanks and best regards,
>
> Ralf
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] Re: undefined index

2015-10-01 Thread Marco Pivetta
I doubt that an interface file has any functional logic in it: check the
file contents, please.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 1 October 2015 at 09:45, aloksdubey [via Zend Framework Community] <
ml-node+s634137n4662700...@n4.nabble.com> wrote:

> Notice: Undefined index: z47e056 in
> /home/trendsake/public_html/lib/Zend/Log/Formatter/Interface.php .
>
> Kindly check out www.trendsake.com
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/undefined-index-tp4662700.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/undefined-index-tp4662700p4662701.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: EdpSuperluminal Configuration in WAMP

2015-09-22 Thread Marco Pivetta
You'd just install it and enable it in the modules list. EdpSuperluminal
doesn't need configuration.
On Sep 22, 2015 19:34, "sreejith_y [via Zend Framework Community]" <
ml-node+s634137n4662683...@n4.nabble.com> wrote:

> Hi,
>
> Am very new to Zend 2 and I have a zend project with me. How Do I enable
> EdpSuperluminal in the project?
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/EdpSuperluminal-Configuration-in-WAMP-tp4662683.html
> To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/EdpSuperluminal-Configuration-in-WAMP-tp4662683p4662684.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] (In what case) Can a ServiceManager Injection be warrantable?

2015-08-05 Thread Marco Pivetta
Hello Automatix,

Locations that I found to be legit use-case scenarios for the
ServiceLocator are:

 - factories
 - abstract factories
 - any kind of lookup map, such as:
* a connection pool
* map from name to service (such as in the DispatchListener in ZF2)

Basically, it drills down to either scrap code or code that is actually
doing some "location" job.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 5 August 2015 at 10:52, automatix  wrote:

> Hello Community!As is generally known injecting the ServiceManager as
> dependency is a bad practice. Nonetheless -- are there
> compromises/exceptions, where it would be acceptable in your opinion? Is a
> Factory for example such a case:vs.Thanks & regards,Ilya
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/In-what-case-Can-a-ServiceManager-Injection-be-warrantable-tp4662642.html
> Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: unable to move zend2 project into live(dedicated windows server)

2015-06-19 Thread Marco Pivetta
Are you sure that the web server is actually running apache, and not some
horror like IIS?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 19 June 2015 at 13:34, shafi [via Zend Framework Community] <
ml-node+s634137n4662594...@n4.nabble.com> wrote:

> @demonkory thanks bro,
> i'm working in a company they will not allow to connect in teamviewer
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/unable-to-move-zend2-project-into-live-dedicated-windows-server-tp4662592p4662594.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/unable-to-move-zend2-project-into-live-dedicated-windows-server-tp4662592p4662595.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: [zf-contributors] Zend Framework 2.4.0 Released!

2015-03-31 Thread Marco Pivetta
Awesome news!

Nice to see that the hard work paid off - the amount of solved issues is
just ginormous!

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 31 March 2015 at 19:37, Matthew Weier O'Phinney  wrote:

> Hi, all!
>
> We've just released version 2.4.0 STABLE of Zend Framework!
>
> The announcement is much to long to fit in an email, as it encompasses
> over 300 patches, done over a period of a year!
>
> Salient notes, however:
>
> - We now support PHP 7 nightly builds!
> - ZF 2.4.0 is our first Long Term Support version!
> - Look for us to start developing towards ZF3 in the very near future!
>
> For full details:
>
> - http://bit.ly/zf-2-4-0
>
> Enjoy!
>
> --
> Matthew Weier O'Phinney
> Principal Engineer
> Project Lead, Zend Framework and Apigility
> matt...@zend.com
> http://framework.zend.com
> http://apigility.org
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>


[fw-general] Re: ZF2 Custom View Helper problem

2015-01-25 Thread Marco Pivetta
Hi Erinaka,

On 25 January 2015 at 22:55, erkinaka [via Zend Framework Community] <
ml-node+s634137n4662444...@n4.nabble.com> wrote:

> i have the error below whe i use custom view helper. but it works on
> local. it doesn't work on far host.
>
>
>
> *Warning:
> require_once(/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php):
> failed to open stream: No such file or directory in
> /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php
> on line 138 Fatal error: require_once(): Failed opening required
> '/home/webnolog/public_html/sinav/module/Sorubankam\View\Helper\Testhelper.php'
> (include_path='.:/opt/php55/lib/php') in
> /home/webnolog/public_html/sinav/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php
> on line 138*
>
>
> my module.config.php
>
>
>
>
>
> * 'view_helpers' => array( 'invokables' => array(
> 'test_helper' => 'Sorubankam\View\Helper\Testhelper', ) ),*
>
>
> my testhelper
>
>
>
>
>
>
>
>
>
>
>
> * Zend\View\Helper\AbstractHelper;   class Testhelper extends AbstractHelper
> {   public function __invoke($output = 'bar') { return "$output , this
> is ZF2 View Helper"; }   }*
>

You probably used an incorrect path where saving a file, like in following
example:

src/SoRUbanKAM/View/helper/TESTHELPER.pHp


This works on windows/osx, but will break when using a case-sensitive
filesystem (linux, by default).

Consider developing in a VM that reflects your production environment.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Custom-View-Helper-problem-tp4662444p4662445.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: How to use redirect() outside controller in zend 2

2015-01-16 Thread Marco Pivetta
Why would you want to use the redirect helper in a module?

Anyway, the redirect helper code is trivial:
https://github.com/zendframework/zf2/blob/8615f24ebdfa905cc719be3c57649e93ea40ef20/library/Zend/Mvc/Controller/Plugin/Redirect.php#L62-L65

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 16 January 2015 at 11:35, Arvind Jha [via Zend Framework Community] <
ml-node+s634137n4662425...@n4.nabble.com> wrote:

> $renderer = $sm->get('Zend\View\Renderer\RendererInterface');
> $url = $renderer->basePath('/album/index/login');
> return $this->redirect()->toUrl($url);
>
> Above code work in controller but not in module.php
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/How-to-use-redirect-outside-controller-in-zend-2-tp4662425.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-use-redirect-outside-controller-in-zend-2-tp4662425p4662426.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: How to create entity of one table in zend 2 Doctrine 2

2015-01-14 Thread Marco Pivetta
The "filter" parameter accepts regular expressions, as far as I know. Look
at the code, please.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 14 January 2015 at 11:23, Arvind Jha [via Zend Framework Community] <
ml-node+s634137n4662418...@n4.nabble.com> wrote:

> Thanks Marco
>
> This is how I tried
>
> php doctrine-module orm:convert-mapping --namespace="Album\Entity\\"
> --force  --from-database annotation ./module/Album/src/ --filter=track
>
> track is the table I have added and it says "No Metadata Classes to
> process"
>
> Any idea, why? :(
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/How-to-create-entity-of-one-table-in-zend-2-Doctrine-2-tp4662416p4662418.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-create-entity-of-one-table-in-zend-2-Doctrine-2-tp4662416p4662419.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: How to create entity of one table in zend 2 Doctrine 2

2015-01-14 Thread Marco Pivetta
The `orm:convert-mapping` command supports a `filter` optional parameter.

See
https://github.com/doctrine/doctrine2/blob/9c3cb579313ae01cdd3467b9f89fc15e9677b46c/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php#L55-L58
for reference.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 14 January 2015 at 11:02, Arvind Jha [via Zend Framework Community] <
ml-node+s634137n4662416...@n4.nabble.com> wrote:

> Hello eveyone,
>
> Suppose I have 5 table in my database and I did some changes in one of the
> table or added one more table after creating entity.
>
> Code below creates entity of whlole DB but I want to create entity of just
> one table.
> php doctrine-module orm:convert-mapping --namespace="Album\Entity\\"
> --force  --from-database annotation ./module/Album/src/
>
> Any suggestion will be helpfull. :)
>
> Thanks
> Arvind Jha
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/How-to-create-entity-of-one-table-in-zend-2-Doctrine-2-tp4662416.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-create-entity-of-one-table-in-zend-2-Doctrine-2-tp4662416p4662417.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Absolute links on partial views

2015-01-13 Thread Marco Pivetta
Hi Galvao,

On 13 January 2015 at 02:48, Er Galvao Abbott  wrote:

> Hi everyone.
>
> I can't seem to be able to create an absolute link on a partial view.
> From static fixed values (e.g.: http://www.google.com) to dynamic
> variables, going through the url helper with the 'force_canonical'
> option set to true and even the serverUrl helper nothing seems to work.
>
> I always end up with a link that's relative to the current URL, e.g.:
> http://myproject/records/http://www.google.com
>
> Everything works fine in regular views, so what am I missing here?


It would be helpful if you provided an example with what you have so far:
the information provided in this post seems insufficient to discover what
is going on.

Consider creating a gist about what you have right now at
https://gist.github.com/

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


[fw-general] Re: logger: adding user defined priorities

2014-12-15 Thread Marco Pivetta
Heya,

I don't think the ZF2 logger has such a feature, and maybe the docs are
simply out of sync because they were ported when ZF2 was released.

I suggest digging in the existing test suite to see if anything suggests
usage of non-standard log levels.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 15 December 2014 at 08:59, tmak [via Zend Framework Community] <
ml-node+s634137n4662407...@n4.nabble.com> wrote:
>
> Hi,
>
> I would like to add some more DEBUG levels to the ZF2 logger.
> Though the documentation
> <http://framework.zend.com/manual/2.3/en/modules/zend.log.overview.html> 
> states
> that *"You may define priorities of lower importance than DEBUG"*, I
> failed finding a addPriority() method as used to exist in ZF1.
>
> How should one then go about this? Is there anywhere an example that
> demonstrates this operation?
>
> thanks,
> Eyal
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/logger-adding-user-defined-priorities-tp4662407.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/logger-adding-user-defined-priorities-tp4662407p4662408.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: 2D Barcode generation (e.g. DataMatrix ECC200)

2014-12-12 Thread Marco Pivetta
I strongly suggest that you look at https://github.com/Bacon/BaconQrCode

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 12 December 2014 at 08:25, calosteward [via Zend Framework Community] <
ml-node+s634137n4662403...@n4.nabble.com> wrote:

> ZF is good. But I'm not sure whether it support all barcodes.
> I use another barcode software to generate datamatrix
> <http://www.onbarcode.com/csharp/data-matrix-generator.html>.
>
> But for your requirement. I found a reference for you:
> how to create 2d bar code <http://www.onbarcode.com/qr_code/>
> You can find some tutorial about create qr code, data matrix and pdf 417.
> Good luck.
> You can ask me any questions again.
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/2D-Barcode-generation-e-g-DataMatrix-ECC200-tp663138p4662403.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/2D-Barcode-generation-e-g-DataMatrix-ECC200-tp663138p4662404.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: modules.zendframework.com 503 stop working

2014-12-11 Thread Marco Pivetta
Please see
https://github.com/zendframework/modules.zendframework.com/issues/260

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 11 December 2014 at 17:25, Eugene Poleacov [via Zend Framework
Community]  wrote:

> Hi, Everybody.
>
> Anybody knows why http://modules.zendframework.com/ just throw:
> Service Temporarily Unavailable
> http://github.com/zendmaniacs
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/modules-zendframework-com-503-stop-working-tp4662400.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click here
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML
> <http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/modules-zendframework-com-503-stop-working-tp4662400p4662401.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Zf2 manual leaking memory

2014-11-17 Thread Marco Pivetta
On 17 November 2014 07:41, Mads Lie Jensen  wrote:

> Hi
>
> I often have one or even more copies of the ZF2 manual (
> http://framework.zend.com/manual/2.3) open i chrome.
>
> Now I noticed that chrome is leaking _lots_ of memory with this page.
> When I opened the page, it used around 70.000 kb according to Chromes
> job-list (hold Shift+escape when in Chrome). This morning, after the
> computer has been sleeping all night, it uses 500.000 kb.
>
> Yesterday, when I became avere of this problem, one of the tabs with the
> manual in it, used 3,7 gb of ram. This is a major problem, even though my
> pc has plenty of ram.
>
> I tried to find out what caused it, but no luck. I suspect that it is the
> Disqus-integration that is to blame, but I'm not sure.
>

I also see a bunch of trackers on that page: are you sure that it is none
of them?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] @ZendTeam : ping

2014-11-11 Thread Marco Pivetta
Hi Ralf,

On 11 November 2014 07:30, Ralf Eggert  wrote:

> Hi,
>
> while I think that no 3 is an interesting idea, I'm afraid it will piss
> off a lot of people if components like Zend\Config, Zend\Db,
> Zend\Console, or Zend\Permissions get kicked for a ZF3 release.
>

Not really kicked, just all components would be exploded into smaller libs,
as they should be.


> I am doing a lot of ZF2 beginner trainings these days and most of my
> attendees are planning to use ZF2 as a full-stack framework. Some come
> from ZF1, others are at the stage to use the first Open-Source framework
> in their work and picked ZF2. There was a lot of frustration in the ZF2
> users community because they felt left a lone on the migration stuff. No
> 3 might be the final death blow if the very strict list of components
> Michaël suggested will build the new ZF3.
>

This has been discussed, and indeed there's no intention to cause a major
BC break: the components will just be exploded, not removed.


> Please don't get me wrong. I don't care about stuff like Zend\Barcode or
> Zend\Text or Zend\Captcha. But to take out too much components from the
> core might be wrong choice.
>
> Nevertheless, I am really interested in any feedback from Matthew and
> his team on this. From the comments for Michaëls blog post I understand
> that there was an IRC meeting, but no official statement yet.
>

Waiting for that as well. As mentioned in my previous response to Emmanuel,
for now we need to push 2.4 out the door.

Greets,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] @ZendTeam : ping

2014-11-10 Thread Marco Pivetta
Hi Emmanuel,

On 10 November 2014 23:11, Emmanuel Bouton  wrote:

> Hi all,
>
> I'm a ZF coder for 5 years now. I started with ZF1 and enjoyed its
> simplicity.
> Then I moved to ZF2 and enjoyed its ability to lead us writing clean code.
>
> However by now I'm really confused by the status of the framework :
>
>  - Activity of the mailing lists (fw-general + fw-contributors) : 10
> threads / month max
>

Yes, that's probably due to the fact that nabble is a terrible, terrible
interface for interacting with the mailing list (I use it scarcely myself
too), and the mailing list itself is not used that much anymore since
development discussions typically happen on github, while questions go to
Stackoverflow.


>  - Activity of the source repository :
> https://github.com/zendframework/zf2/graphs/commit-activity
>=> really scary !
>

Nothing scary at all to be honest: merges happen in bursts when someone has
time to handle them (someone in the CR team: next up is me, in order to
push 2.4 out the door, which should happen in the next weeks).


> Did I missed something ?
>
> I know that you guys are working hard on apigility, and I'm sure that it is
> an exciting project, but don't forget that if the framework dies, apigility
> won't survive !
>

Apigility is the focus of the Zend team, not of all the community nor the
CR team.

I'm definitively not a fan of Symfony but you must recognise that they have
> a really aggressive marketing, a strong and active community, a really good
> documentation, and so on !
>
> So if nothing is done in the next month, it will be harder and harder for
> your fervent defenders to have arguments against your detractors !!!
>

Agree on that, but we don't have marketing for ZendFramework at all, since
it's mainly a community project, and not the primary focus of any company.
As for the community, it needs to wake up indeed: most frequent
contributors are mainly off building small decoupled components that don't
even depend on ZF, that's why you don't really see ZF mentioned a lot.
I actually think this is a good thing (decoupled, independent components:
it means that there is some maturity in design decisions being made), but
it may indeed be perceived as low developer activity.


> I'm sure that you already have read the blog post of Michael :
> http://www.michaelgallego.fr/blog/2014/10/04/status-of-zend-framework-3/
> Please take the time to give an answer ! Give us more visibility !
>
> My comment on this post :
>  - Choice n°1 : nobody wants that but it's definitively up to you guys !
>  - Choice n°2 : acceptable solution but doesn't seems to fit with your
> availability.
>  - Choice n°3 : my favourite ;)
>

Some actions have been taken exactly based on that post.
What can be said here is that ZF 2.4 needs to be released before we
kickstart things again, and it takes some effort to get there (a couple
hundred issues to deal with: will likely do this week).


> Please don't be offended by my words, I'm just a little sheep that needs to
> be reassured by his shepherd ;)
>

You're not the first to ask about this situation, nor I think you will be
the last, so no need to worry, nobody is being offended by perfectly legit
questioning.

Greets,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: Multiple authentications

2014-11-10 Thread Marco Pivetta
Hi Emmanuel,

If your controllers implement at least one marker interface or have
something that makes them recognizable at first sight by any automated
security checks, then it's trivial to implement a listener attached to the
SharedEventManager that:

 - listens for the controller's \Zend\Mvc\MvcEvent::EVENT_DISPATCH with a
high priority
 - is attached only to event identifiers representing those "marker
interfaces"

Greets,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 7 November 2014 23:33, Emmanuel Bouton  wrote:

> Or should I simply check the authentication on top of each my action ? (a
> bit repetitive ...)
>
> 2014-11-07 23:27 GMT+01:00 Emmanuel Bouton :
>
> > 2014-11-07 23:19 GMT+01:00 Emmanuel Bouton :
> >
> >> Hi all,
> >>
> >> In my app I have 3 types of controllers :
> >>  - Public controllers without any authentication
> >>  - SSO Authenticated controllers
> >>  - HTTP Basic Authenticated controllers (for a webservice part)
> >>
> >> How should I manage these 2 way of authentication ? In controllers
> >> onDispatch method ? Through events (which one) ?
> >>
> >> Said differently, I don't know where I should put this code for both of
> >> my authentication services :
> >>
> >
> > => Erratum : for both of my adapters ;)
> >
> >
> >>
> >> if (!$authenticationService->hasIdentity()) {
> >> $authenticationService->authenticate($adapter);
> >> }
> >>
> >> Any ideas ?
> >>
> >> Thanks
> >> Emmanuel
> >>
> >
> >
>


[fw-general] Re: Zend Framework 2 - Vendor package question

2014-10-23 Thread Marco Pivetta
Hey Jhon,

On 23 October 2014 21:49, Jhon [via Zend Framework Community] <
ml-node+s634137n4662342...@n4.nabble.com> wrote:

> Hello Marco, thank you for the response.
> Yes I have learned about the module system, and please do correct me if I
> am wrong, in every module you can encapsulate a lot of functionality, but I
> was thinking like this, almost every application will need a front module
> to be visible to the user and a module for the admin, they will not
> interact, every module has its own set of rules to achieve.
>

Modules are *NOT* sections of a website. Modules are reusable components
that provide settings/services and in general functionality in a ZF2
application.

A module may, in its general form, be anything. Separating modules by site
sections is generally a mistake, as an "admin" and a "frontend" page may
rely on the same service logic.


> But is there a method to make a module/library to inject in both modules
> different behaviour? ( example: I want at one point to add a simple
> checkout, in admin I want to have a page where I can make some settings for
> that checkout and in the front the checkout page. Is it not better and
> quicker to make a package that will run on every zf2 project if they have
> some required refferences ( admin and front ) with own views or view
> blocks, own route instead of merging new config with old one, transfer the
> controller, model and view you need in the new project? Or this is possible
> in zf2 and I have to learn and read more?
>

You can just keep different configs for admin and frontend views. You don't
need to "replace" URLs in your application to make them "admin" or
"frontend" depending on a config setting: just use different URIs.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-Vendor-package-question-tp4662340p4662343.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Zend Framework 2 - Vendor package question

2014-10-23 Thread Marco Pivetta
Hi Jhon,

On 23 October 2014 15:17, Jhon [via Zend Framework Community] <
ml-node+s634137n4662340...@n4.nabble.com> wrote:

> I am working for some time on Zend Framework 2 and everything is pretty
> fun and cool. Now I am trying to make something like can be made in Magento
> pretty easy ( extensions ) that will help develop on new ZF2 project. Is it
> possible to make a vendor package that can have n extension ( like
> submodules ) items and be plugged in the main modules and just add
> components in a way for the view, routes, etc.. something like Magento
> extensions system. Is it possible? Is there a good point to start from to
> achieve this?
>

Did you look at the modules system? And composer? That's pretty much all
you need :-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-Vendor-package-question-tp4662340p4662341.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] converting errors to exceptions

2014-09-22 Thread Marco Pivetta
Hi,

On 21 September 2014 01:41, goat  wrote:

> I much prefer to do error handling with exception semantics, opposed to
> checking function return values and error codes. I want to set my own php
> error handler function, which converts all native php errors into thrown
> exceptions.


> But, I'm a bit scared to do this with code that wasn't written with this in
> mind, which is probably the majority of php code. It's a huge difference in
> program control flow to do this, and I fear I might break the zf2 code by
> doing so. I know exceptions are used extensively throughout the zf2 code
> base, but, I'm not sure it was written with the anticipation that native
> php
> functions would throw exceptions.
>

ZF2 pretty much always wraps error-spawning functions such as `fopen` or
`file_get_contents` with `Zend\Stdlib\ErrorHandler` (see
https://github.com/zendframework/zf2/blob/026ea4888c7d5705a1ac89aff700d4c952ebbaab/library/Zend/Stdlib/ErrorHandler.php).
That turns any errors raised into exceptions that are then handled by the
framework or by you. We typically avoid warnings/notices, and they make our
test suite fail as well.


> Is it common to do this in zend 2? Have people had a good experience with
> it?
>

Yes, we simply don't use user-level errors, only exceptions. There are few
cases where this is not true, but that's because you should fix your code
in those particular cases.


> ps - I'm also using the BjyAuthorize module.
>

BjyAuthorize should be error-free (only exceptions).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Can we initialize a service at Bootstrap?

2014-09-22 Thread Marco Pivetta
Hi Juan,

On 19 September 2014 19:20, Juan Pedro Gonzalez 
wrote:

> Hi,
> Can a service be initialized at bootstrap automatically?
> I've written a multilingual library which loads a custom router to take
> care of the locale which can be located at
> https://github.com/JPG-Consulting/LocaleManager. The problem here is I
> must inject some instances to the router class so it works fine. This is
> done throw the service fctory of the LocaleManager service... As you can
> see in the Module.php file I do this by providing a bootstrap method and
> getting my service  so it gets created.
>

I would advise _AGAINST_ using any of this context-switching done at
runtime: instead, pass in whatever router you get, and do the decisions in
the router implementation. To be more clear:

// bad example
if ($thinger->hasThing()) {
return $serviceA;
} else {
return $serviceB;
}

// good example
class GoodService
{
public function __construct(Thinger $thinger, ...) {
$this->thinger = $thinger;
// ...
}

public function doFoo() {
if ($this->thinger->hasThing()) {
return $this->serviceA->doFoo();
}

return $this->serviceB->doFoo();
}

This is a very subtle but VERY important difference.


> Most of this "module" can be configured right away in the
> module.config.php of any of the modules not needing to register the
> module... But in order to do so i need a way to initialize my service
> automatically within the application and not the module itself. Is there a
> way to accomplish this task?
>

Inject the service that will give you the data you need into the
"aggregate" "GoodService", then do the decision by fetching the data at
runtime.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] ZF2 Code Sniffer Ruleset

2014-08-18 Thread Marco Pivetta
Hi Ralf,

We actually only follow PSR-2. It would be interesting to follow stricter
standards though, like:

 - https://github.com/object-calisthenics/phpcs-calisthenics-rules
 - https://github.com/doctrine/coding-standard

Changing these involves A LOT of work, and may also not be well accepted by
some package maintainers.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 18 August 2014 08:21, Ralf Eggert  wrote:

> Hi,
>
> I am looking for an up-to-date ZF2 ruleset for PHP CodeSniffer. I would
> like to integrate it in PhpStorm which only offers rulesets for ZF1,
> PSR-1 and PSR-2 amongst others.
>
> This project looks a bit outdated.
>
> https://github.com/farazdagi/zf2-codesniffer
>
> I remember that ZF2 uses an adapted version of PSR-2, or is that wrong?
>
> Thanks and best regards,
>
> Ralf
>
> --
>
> Ralf Eggert  -  Travello GmbH  -   An der Eiche 15  -  25421 Pinneberg
> Tel 04101/8529401  -  Fax 04101/8529402  -  Web http://de.travello.com
> Geschäftsführer: Ralf Eggert   -   Amtsgericht Pinneberg:  HRB 6112 PI
>
> Ralf Eggert ist Autor des Buches   "Zend Framework 2 - Das Praxisbuch"
> http://www.galileocomputing.de/3460?GPP=eggert
>
> Zend Framework 2 Schulung buchen:  http://www.zendframeworkschulung.de
>
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Apigility - ongoing support & development ?

2014-07-28 Thread Marco Pivetta
Hi,

On 28 July 2014 23:36, Brian Gallagher  wrote:

>
> What features are on the roadmap? One of the strengths of ZF2, IMO, are the
> third party modules, do you envision a similar ecosystem for apigility?
>

Apigility is just a ZF2 application with a different skeleton. Modules just
work with it, as they do with normal zf2 apps.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Reduce basic request time of an ZF2 application

2014-07-17 Thread Marco Pivetta
On Thu, Jul 17, 2014 at 10:52 AM, Ralf Eggert  wrote:

> Hi Marco,
>
> > Is there a varnish instance in front of it? Are you stripping cookies?
>
> Nope. Just a good old LAMP.
>

You really need some varnish then - if it is REST and you can cache,
without varnish you are just hurting yourself ;-)

> Additionally, move your modules' autoloading to `composer.json` and use a
> > classmap via `./composer.phar dump-auoload --optimize`.
>
> Ok, is composer autoloading really much faster than Zend\Loader
> autoloading? Didn't know that yet.
>

It is, by a lot too!
Consider that the impact on the skeleton application is at least 30% of the
runtime.


> > HHVM is also a neat suggestion, but don't expect miracles from it: it
> just
> > makes repeated operations faster.
>
> Well, and PHP-NG is also worth a try but since the project is hosted by
> 1&1 that will be no solution in the near future.
>

Probably the worst hosting solution around right now (in my own personal
opinion, given their awesome "upgrade strategy), but I can understand why
this choice was made :-(

You really want to move to your own VPS where you can setup services as you
like.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] zfmodules

2014-07-17 Thread Marco Pivetta
On Thu, Jul 17, 2014 at 10:35 AM, Ralf Eggert  wrote:

> Hi Marco,
>
> Marco Pivetta schrieb am 17.07.2014 09:48:
> > Why is everyone re-iterating the same question over, and over, and over,
> > and over, and over, and over, and over again?
> >
> > There is an issue:
> > https://github.com/zendframework/modules.zendframework.com/issues/183
>
> Sorry, I did not know that. Thought it is a temporary problem and wasn't
> aware that there is an issue already.
>
> 17 days? WTF! Was there a firestorm? ;-)
>

2 drives on RAID 1 failed simultaneously (yay! thank you, luck!) while we
were at DPCON (can't remember if it was the first conference day).
We assumed it was a RAID controller failure, so Evan checked the machine at
the DC as soon as he got back.
The drives were sent to a white room for recovery, and that is taking much
more than expected.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] zfmodules

2014-07-17 Thread Marco Pivetta
On Thu, Jul 17, 2014 at 8:51 AM, Andreas Möller  wrote:

>
> >> What happened to the website zfmodules (was it
> modules.zendframework.com)?
> >> Doesn't seem to be online anymore.
> >
> > I still get an "Service Temporarily Unavailable" error. Who can setup
> > the website again?
>
> Looks like it's back up again right here:
>
> http://symfohub.com/bundles
>
> Just kidding, LOL.
>
> But hey, ZF, are you letting us down?
>

Why is everyone re-iterating the same question over, and over, and over,
and over, and over, and over, and over again?

There is an issue:
https://github.com/zendframework/modules.zendframework.com/issues/183

Kthxbai.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Reduce basic request time of an ZF2 application

2014-07-07 Thread Marco Pivetta
Hi Ralf,

On 7 July 2014 10:44, Ralf Eggert  wrote:

> Hi Marco,
>
> thanks for your ideas.
>
> > Did you consider caching at HTTP level first?
>
> Yep. I have set the following:
>
> Cache-Control: cache, store
> Expires: Thu, 01 Dec 1983 20:00:00 GMT
> Etag: 2e922b7d992758b1ee143aa70cf2ab05
> Pragma: cache
>
> But with no effect.
>

Is there a varnish instance in front of it? Are you stripping cookies?

> ZeffMu plays quite aggressively with that:
> https://github.com/BinaryKitten/ZeffMu

Nice one. Will have a closer look at it, when the view manager
> replacement does not have much effect.


That's just to give you some ideas, it isn't the actual solution.


>  > I never really bothered going lower than that. Caching is the way if
> it's
> > just simple responses without no interference (Remember to set up cache
> > purging correctly)
>
> A proper cache purging might be quite complicated in this case. The data
> returned is geographical nested set data. Purge the cache properly when
> one node changes is not just done by clearing the cache for all children
> and parent and siblings. I will try to work on a concept when all the
> other stuff is leading nowhere.
>

A listener would do fine in this case, and would basically do the
equivalent of `curl -X PURGE ...` against the http cache proxy.

Another thing to try is using a dedicated `EventManager` instance that has
no `SharedEventManager` for instances that are not requiring that kind of
flexibility. This *may* break things, so be careful.

Additionally, move your modules' autoloading to `composer.json` and use a
classmap via `./composer.phar dump-auoload --optimize`.

HHVM is also a neat suggestion, but don't expect miracles from it: it just
makes repeated operations faster.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Reduce basic request time of an ZF2 application

2014-07-03 Thread Marco Pivetta
On 29 June 2014 08:38, Ralf Eggert  wrote:

> Hi,
>
> I have an application that returns only JSON data (not built on
> Apigility). A normal request has a basic request time of about 25ms.
> Config cache is already turned on. I know that it is not much. But still
> I wonder if I can reduce this even more. Speed is a major requirement.
>

Did you consider caching at HTTP level first?


> For example I think that I don't need some of the view listeners or the
> layout template and stuff like that.
>

The view manager can probably completely be replaced with a small listener
that converts `JsonModel` instances into a json http response directly.
Routing can also be simplified if you can collapse multiple routes into
smarter, custom ones.


>
> - Has anyone tried to turn off some of the basic MVC features?
>

ZeffMu plays quite aggressively with that:
https://github.com/BinaryKitten/ZeffMu


> - If yes, how were you able to reduce the request time?
>

I never really bothered going lower than that. Caching is the way if it's
just simple responses without no interference (Remember to set up cache
purging correctly)

- If yes, which features did you turn off and how?
>

The view layer takes a LOT of time to run. It depends on the app, but you
should really profile it first.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Bouncing emails?

2014-06-28 Thread Marco Pivetta
On 26 June 2014 18:57, Philip G  wrote:

> I just got a notice from ZFW list bot saying emails are bouncing from my
> address. I've subscribed using my direct gmail address (vs aliased
> gpcentre.net).
>
> Is there anything I can do on Gmail's side to alleviate this? According to
> the warning message ... there are a lot:
>
> > Here are the message numbers:
> >
> >   41759
>
> 0.o
>

We could really need a migration to google groups, this thing is getting
very annoying over time (also the various spam messages in the list) :P

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


[fw-general] Re: instantiation of validator plugin manager?

2014-06-15 Thread Marco Pivetta
On 14 June 2014 17:28, Oliver Koenig [via Zend Framework Community] <
ml-node+s634137n4662142...@n4.nabble.com> wrote:

> Hi,
>
> I was trying to override a default validator and stumbled upon sometzhing
> I found weird.
> Each instance of Zend\InputFilter\Input instantiates its own instance of
> Zend\Validator\ValidatorChain.
> Each instance of Zend\Validator\ValidatorChain instantiates its own
> instance of Zend\Validator\ValidatorPluginManager.
>

That should only be the case if the input filter was not built through the
InputFilterPluginManager. Can you verify that?


> So that means in effect, every input field with a validator instantiates a
> new ValidatorPluginManager.
>

Also here, only if the form didn't spawn from the FormElementManager


> Is this behaviour supposed to be desirable?
>

No, but the alternate solution is having a static reference to a plugin
manager, which is much worse.


>
> The reason why I was in need to override the behaviour of a default
> validator: I use FilePRG and get the ATTACK error message from the
> validator, because the file is not in the HTTP POST after FilePRG.
> I use factory backed form creation, it's not an option to switch to code
> based form creation.
>

I'd check if you can use the FormElementManager coming from the main
ServiceManager instance to build your forms (or a form factory).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/instantiation-of-validator-plugin-manager-tp4662142p4662145.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Is that a good/bad/neutral practice to pass variables to Controller methods?

2014-06-10 Thread Marco Pivetta
On 10 June 2014 23:21, Julian Vidal  wrote:

> Methods that end in "Action" are supposed to be called automatically by the
> framework, not by you directly.


To be fair, it's not even the framework. It's handled by
`Zend\Mvc\Controller\AbstractActionController#onDispatch()`. Yes, you can't
have parameters on actions when using the `AbstractActionController`.

I like the idea of having parameters passed to controller actions, it is a
concept that I always loved since I saw JAX-RS for java (no kidding! for
those who don't know any J2EE: please go check it out!).

In fact, I and Bakura (Michael Gallego) have even worked on an entire
module that just enables this: https://github.com/zf-fr/zfr-rest

What happens in that particular module is in fact:

 1 - routing determines an "entity" or "collection" that represents the
current REST resource
 2 - the controller is resolved (like normally in a ZF2 Mvc app)
 3 - the controller action is resolved (in this context, that depends on
the HTTP verb being used)
 4 - the resource is passed to the controller action, which has a signature
like `public function patch(SomeEntity $entity) {...}`

I think this greatly simplifies your controller logic, and I'd like to
further extend these concepts to DTOs.

If you find a good way of passing parameters to action controllers without
being too opinionated, then please do share: I'd love to see more
development in this direction.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Zend Framework 1.12.6, 2.2.7, and 2.3.1 Released!

2014-05-23 Thread Marco Pivetta
Hey David,

Template parameter placeholders shouldn't really be part of the user input,
should they? I think you had a quite bad security issue upfront there ;-)

If you really need unescaped strings, then you could eventually override
the `escapeHtmlAttr` helper, but be rally careful about what
you are doing. I won't take responsibility for any security issues
introduced by doing that.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 22 May 2014 07:15, David Muir  wrote:

> The security fix broke our javascript templates that contained form
> elements. :-(
> All the curly braces in attributes are being converted to html entities, so
> our string replace calls aren't finding the braces anymore. Is there a way
> to easily get the old behaviour?
>
> Cheers,
> David
>
>
>
>
> On Wed, Apr 16, 2014 at 6:16 AM, Matthew Weier O'Phinney
> wrote:
>
> > We've just pushed out several new releases:
> >
> > - Zend Framework 1.12.6: This fixes a BC break with regards to a
> > number of Locales that was introduced in 1.12.4; you can read about it
> > at http://bit.ly/zf-1-12-6
> >
> > - Zend Framework 2.2.7 and Zend Framework 2.3.1: These fix a security
> > issue reported at
> > http://framework.zend.com/security/advisory/ZF2014-03 - a potential
> > XSS vulnerability in a number of ZF2 view helpers. Additionally, ZF
> > 2.3.1 contains more than 80 bugfixes; you can read about these
> > releases at http://bit.ly/zf-2-3-1
> >
> > If you are using ZF2, and specifically view helpers, we highly
> > recommend upgrading to either 2.2.7 or 2.3.1 ASAP.
> >
> > Packages are available via composer, pyrus, or
> > http://framework.zend.com/downloads/latest
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead| matt...@zend.com
> > Zend Framework  | http://framework.zend.com/
> > PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
> >
> > --
> > List: fw-general@lists.zend.com
> > Info: http://framework.zend.com/archives
> > Unsubscribe: fw-general-unsubscr...@lists.zend.com
> >
> >
> >
>


Re: [fw-general] [ZF2]What is the best way to run something on every controller of a module?

2014-05-21 Thread Marco Pivetta
Hi Jamie,

This is pretty easy. Given the EventManager of an application:

$application->getEventManager()->getSharedManager()->attach('ModuleName',
'dispatch', function ($e) {
echo 'controller ' . get_class($e->getTarget()) . ' dispatched';
});

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 22 May 2014 00:29, Jamie Krasnoo  wrote:

> I'm trying to figure out what would be more appropriate when you need to
> run something for every controller and its actions in a Module. Currently I
> have a callback registered to the route event and check the route match
> name for the module name and return if it's not and move forward if it is.
> Is there a better way to do this rather than having something that runs for
> every module looking for that particular module to run or having to put
> repetitive code in every controller?
>
>
> Jamie
>


Re: [fw-general] JavaScript and CSS within module

2014-05-04 Thread Marco Pivetta
That's how AM was designed.
AssetManager will cycle through configured resolvers and find (by priority)
the first asset that is a "hit".
That way, multiple modules can map same paths, and the assets will
basically be an union of all modules (depending on priority).

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 4 May 2014 17:54, Jonathan Sundquist  wrote:

> Hello Marco
>
>
>
> On Sun, May 4, 2014 at 10:38 AM, Marco Pivetta  wrote:
>
>> Hi Jonathan,
>>
>> On 4 May 2014 03:52, Jonathan Sundquist  wrote:
>>
>>> I just checked my application and it appears as though that files are
>>> being
>>> loaded via /css/test-file.css instead of /Application/css/test-file.css.
>>>  Does this seem correct or would there be a speed improvement if it
>>> loaded
>>> via /Application?
>>>
>>
>> Correct, files are served 1:1 from the namespaces you mapped in
>> AssetManager. If you need to put an "Application/" in front of those, you
>> either need to use a map resolver (allows you to redefine paths for single
>> assets) or you need to push the assets in an "Application" directory within
>> the module that contains them.
>>
>> That is also a good practice, as it allows you to "namespace" assets to
>> avoid collisions with secondary modules that may provide their own.
>>
>>
>> Cheers,
>>
>> Marco Pivetta
>>
>> http://twitter.com/Ocramius
>>
>> http://ocramius.github.com/
>>
>>
>
> I wonder if I am ding something wrong then as I am able to get items that
> are either in my Applicaiton module or even other modules to resolve under
> only /css. My code can be found at
> https://bitbucket.org/jsundquist/zf2-sample-application.
>


Re: [fw-general] JavaScript and CSS within module

2014-05-04 Thread Marco Pivetta
Hi Jonathan,

On 4 May 2014 03:52, Jonathan Sundquist  wrote:

> I just checked my application and it appears as though that files are being
> loaded via /css/test-file.css instead of /Application/css/test-file.css.
>  Does this seem correct or would there be a speed improvement if it loaded
> via /Application?
>

Correct, files are served 1:1 from the namespaces you mapped in
AssetManager. If you need to put an "Application/" in front of those, you
either need to use a map resolver (allows you to redefine paths for single
assets) or you need to push the assets in an "Application" directory within
the module that contains them.

That is also a good practice, as it allows you to "namespace" assets to
avoid collisions with secondary modules that may provide their own.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] JavaScript and CSS within module

2014-05-02 Thread Marco Pivetta
Hi Jonathan,

That is correct, http://localhost/Application/css/test-file.css is the URI
from which the file will be served by the ZF2 application.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 3 May 2014 05:14, Jonathan Sundquist  wrote:

> Hi Marco,
>
> Thank you for your reply.  Your blog post is exactly what I am looking
> for.  One question on it though. When it states that I should test the
> application using
> http://localhost/path/to/ZendSkeletonApplication/Application/css/test-file.css,
> if I am using a vagrant instance and /Application is actually at the root
> should I be able to just go http://localhost/Application/css/test-file.cssif 
> everything is set up correctly?  If that is the case that I think I
> missed something.
>
> Thanks,
> Jonathan
>
>
> On Fri, May 2, 2014 at 6:51 PM, Marco Pivetta  wrote:
>
>> Hi Jonathan,
>>
>> You may want to look at asset-management modules such as AssetManager (I
>> described it at
>> http://ocramius.github.io/blog/asset-manager-for-zend-framework-2/ ) (
>> https://github.com/RWOverdijk/AssetManager ) or BaconAssetLoader (
>> https://github.com/Bacon/BaconAssetLoader ).
>>
>> Cheers,
>>
>> Marco Pivetta
>>
>> http://twitter.com/Ocramius
>>
>> http://ocramius.github.com/
>>
>>
>> On 2 May 2014 22:26, Jonathan Sundquist  wrote:
>>
>>> Good afternoon.
>>>
>>> I'm working on a project where we have a lot of modules. We are looking
>>> to
>>> have each module contain the css, images, and javascript required for it
>>> to
>>> function. According to
>>>
>>> http://framework.zend.com/manual/2.1/en/modules/zend.module-manager.intro.htmlit
>>> should be possible but when I call /css/style.css it cannot find the
>>> file? I do have a public directory located under my module at the same
>>> level as src. Is there something else I need to do?
>>>
>>> Thanks,
>>> Jon
>>>
>>
>>
>


Re: [fw-general] JavaScript and CSS within module

2014-05-02 Thread Marco Pivetta
Hi Jonathan,

You may want to look at asset-management modules such as AssetManager (I
described it at
http://ocramius.github.io/blog/asset-manager-for-zend-framework-2/ ) (
https://github.com/RWOverdijk/AssetManager ) or BaconAssetLoader (
https://github.com/Bacon/BaconAssetLoader ).

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 2 May 2014 22:26, Jonathan Sundquist  wrote:

> Good afternoon.
>
> I'm working on a project where we have a lot of modules. We are looking to
> have each module contain the css, images, and javascript required for it to
> function. According to
>
> http://framework.zend.com/manual/2.1/en/modules/zend.module-manager.intro.htmlit
> should be possible but when I call /css/style.css it cannot find the
> file? I do have a public directory located under my module at the same
> level as src. Is there something else I need to do?
>
> Thanks,
> Jon
>


[fw-general] Re: Double insert in the database with form, in zend 2.2 y 2.3

2014-03-28 Thread Marco Pivetta
Hey Donatello,

I have no idea why you have that redirect, but I'd suggest trying out the
project just with the internal PHP server to cut out problems with XAMPP if
there are any.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 28 March 2014 16:51, donatello [via Zend Framework Community] <
ml-node+s634137n4661931...@n4.nabble.com> wrote:

> Marco,
> I think i found the problem but don't understand why.
>
> 2014-03-28T16:45:30+01:00 DEBUG (7): Wrote a db record!array (
>   'REDIRECT_BASE' => '/zend2.3/Project/public/',
>   'REDIRECT_MIBDIRS' => 'C:/xampp/php/extras/mibs',
>   'REDIRECT_MYSQL_HOME' => '\\xampp\\mysql\\bin',
>   'REDIRECT_OPENSSL_CONF' => 'C:/xampp/apache/bin/openssl.cnf',
>   'REDIRECT_PHP_PEAR_SYSCONF_DIR' => '\\xampp\\php',
>   'REDIRECT_PHPRC' => '\\xampp\\php',
>   'REDIRECT_TMP' => '\\xampp\\tmp',
>   'REDIRECT_STATUS' => '200',
>   'MIBDIRS' => 'C:/xampp/php/extras/mibs',
>   'MYSQL_HOME' => '\\xampp\\mysql\\bin',
>   'OPENSSL_CONF' => 'C:/xampp/apache/bin/openssl.cnf',
>   'PHP_PEAR_SYSCONF_DIR' => '\\xampp\\php',
>   'PHPRC' => '\\xampp\\php',
>   'TMP' => '\\xampp\\tmp',
>   'HTTP_HOST' => 'localhost:2333',
>   'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:27.0)
> Gecko/20100101 Firefox/27.0',
>   'HTTP_ACCEPT' =>
> 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
>   'HTTP_ACCEPT_LANGUAGE' => 'it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3',
>   'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
>   'HTTP_REFERER' => '
> http://localhost:2333/zend2.3/Project/public/application/Lavoro/register',
>
>   'HTTP_CONNECTION' => 'keep-alive',
>   'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
>   'CONTENT_LENGTH' => '49',
>   'PATH' =>
> 'C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program
> Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\ATI
> Technologies\\ATI.ACE\\Core-Static;C:\\xampp\\php;C:\\Program
> Files\\TortoiseSVN\\bin;C:\\Git\\bin;C:\\HashiCorp\\Vagrant\\bin;C:\\Program
> Files (x86)\\QuickTime\\QTSystem\\;',
>   'SystemRoot' => 'C:\\Windows',
>   'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe',
>   'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
>   'WINDIR' => 'C:\\Windows',
>   'SERVER_SIGNATURE' => 'Apache/2.4.3 (Win32) OpenSSL/1.0.1c
> PHP/5.4.7 Server at localhost Port 2333
> ',
>   'SERVER_SOFTWARE' => 'Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7',
>   'SERVER_NAME' => 'localhost',
>   'SERVER_ADDR' => '::1',
>   'SERVER_PORT' => '2333',
>   'REMOTE_ADDR' => '::1',
>   'DOCUMENT_ROOT' => 'C:/xampp/htdocs/esempio/',
>   'REQUEST_SCHEME' => 'http',
>   'CONTEXT_PREFIX' => '',
>   'CONTEXT_DOCUMENT_ROOT' => 'C:/xampp/htdocs/esempio/',
>   'SERVER_ADMIN' => 'postmaster@localhost',
>   'SCRIPT_FILENAME' =>
> 'C:/xampp/htdocs/esempio/zend2.3/Project/public/index.php',
>   'REMOTE_PORT' => '62152',
>   'REDIRECT_URL' => '/zend2.3/Project/public/application/Lavoro/process',
>   'GATEWAY_INTERFACE' => 'CGI/1.1',
>   'SERVER_PROTOCOL' => 'HTTP/1.1',
>   'REQUEST_METHOD' => 'POST',
>   'QUERY_STRING' => '',
>   'REQUEST_URI' => '/zend2.3/Project/public/application/Lavoro/process',
>   'SCRIPT_NAME' => '/zend2.3/Project/public/index.php',
>   'PHP_SELF' => '/zend2.3/Project/public/index.php',
>   'REQUEST_TIME_FLOAT' => 1396021526.646,
>   'REQUEST_TIME' => 1396021526,
> )
>
>
>
> It call "process" action (the action that call the method createUser()
> which write on th db) two times
>
> 'REDIRECT_URL' => '/zend2.3/Project/public/application/Lavoro/process',
>
> and
>
>  'REQUEST_URI' => '/zend2.3/Project/public/application/Lavoro/process',
>
> It can be the problem? How i can fix it?
>
> Thanks a lot!
>
>
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661931.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661932.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Double insert in the database with form, in zend 2.2 y 2.3

2014-03-28 Thread Marco Pivetta
As a matter of fact, I just had the same "double submit" issue because of
how chrome tries to load favicons.

I'd suggest adding a logger to verify what is going on:

$logger = new Zend\Log\Logger;
$writer = new Zend\Log\Writer\Stream(fopen(...));

$logger->addWriter($writer);

$logger->log(Logger::DEBUG, 'Wrote a db record!' . var_export($_SERVER,
true));

That will let you see what is going on and why.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 28 March 2014 15:46, donatello [via Zend Framework Community] <
ml-node+s634137n4661929...@n4.nabble.com> wrote:

> There isn't a double submit Marco. I did a sample exemple without form, a
> simple
>
> $tablegateway->insert($data)
>
> and i have two identical entry in the DB!! WHy?!?!
>
> It make me crazy!! It's a week the i'm searching the solution...
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661929.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661930.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Double insert in the database with form, in zend 2.2 y 2.3

2014-03-26 Thread Marco Pivetta
Hey Donatello,

Yep, I'm Italian :-)

By the way, try using a session container to verify if there actually is a
double submit (I had that once). A counter will do, and you will see if it
is incremented twice.

I also suggest getting rid of xampp and using the internal PHP server when
developing: `php -S localhost:8080 -t public public/index.php` will do.



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 27 March 2014 01:33, donatello [via Zend Framework Community] <
ml-node+s634137n4661921...@n4.nabble.com> wrote:

> THank you Marco! Are you Italian! :) I'm italian!
> Yes, i'm sure not have any double submint!
>
> I post my code:
> in userTable:
>
> public function saveUser(User $user)
> {
> $data = array(
> 'email' => $user->email,
> 'name' => $user->name,
> //'password' => $user->password,
> );
> //$id = (int)$user->id;
>
>
>
> $this->tableGateway->insert($data);
>
> }
>
> in my controller:
>
> public function createUser(array $data){
>
> $sm = $this->getServiceLocator();
> $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
> $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
>
> $resultSetPrototype->setArrayObjectPrototype(new
> \Application\Model\User);
> $tableGateway = new \Zend\Db\TableGateway\TableGateway('user',
> $dbAdapter, null, $resultSetPrototype);
> $user = new User();
>
> $user->exchangeArray($data);
> $userTable = new UserTable($tableGateway);
>
>
>
> $userTable->saveUser($user);
> return true;
>
>
> }
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661921.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661922.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: Double insert in the database with form, in zend 2.2 y 2.3

2014-03-26 Thread Marco Pivetta
Did you verify that you are not having any double submit?

What is the offending code?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 27 March 2014 01:17, donatello [via Zend Framework Community] <
ml-node+s634137n466191...@n4.nabble.com> wrote:

> Hi!
> I’m a very strange problem! My zend run in xampp. All work fine but..when
> i insert datas from a form, i have a double entry in my DB!
> example:
> name:mark
> email:m...@mark.com
>
> in my db i find:
>
> id name email
> 0 mark m...@mark.com
> 1 mark m...@mark.com
>
> I’m sure is not a mysql server problem because i tried in insert from a
> simple php script and all work fine. I’m sure that the values passed from
> the insert are not duplicated. Why it happen?
> I hope you help me, i don’t find nothing about this.
> Thankyou
>
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Double-insert-in-the-database-with-form-in-zend-2-2-y-2-3-tp4661919p4661920.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] test or tests?

2014-03-21 Thread Marco Pivetta
Doesn't really matter, to be honest


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 21 March 2014 23:02, dennis-fedco  wrote:

> https://github.com/ZF-Commons/ZfcBase/tree/master/test, but
> https://github.com/ZF-Commons/ZfcUser/tree/master/tests
>
> Well, which is it ?!  :)
>
> Dennis
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/test-or-tests-tp4661898.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: [Doctrine] Cache in use

2014-03-19 Thread Marco Pivetta
As discussed on #6001, ZF2 can't have per-item TTL by default. It is
trivial to implement a small wrapper for it, as I've written at
https://github.com/zendframework/zf2/pull/5386#issuecomment-29386320

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 19 March 2014 16:39, jmleroux  wrote:

> I made a PR here : https://github.com/zendframework/zf2/pull/6001
>
> If this is accepted, I will make a PR for Zend cache adapter in Doctrine
> Module
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Doctrine-Cache-in-use-tp4661873p4661891.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] How to get list of queries that go through db adapter

2014-03-18 Thread Marco Pivetta
Did you try using BjyProfiler? https://github.com/bjyoungblood/BjyProfiler

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 18 March 2014 18:53, Julian Vidal  wrote:

> I'm looking for a way to get a list of queries that my app executes. I'm
> not looking for profiling, timing info, or anything like that; just a list.
>
> I was hoping that the DB adapter triggered an event that I could catch but
> I can't find anything.
>
> How can this be achieved?
>


Re: [fw-general] [Doctrine] Cache in use

2014-03-18 Thread Marco Pivetta
On 18 March 2014 14:56, LEROUX Jean-Marie  wrote:

> My mistake : i did not see my queries cached in ZDT toolbar, because i did
> not use a '$query->useResultCache(true)'.
>
> Now i can see they are cached.
>
> I'm testing the use of '$query->setHydrationCacheProfile(new
> QueryCacheProfile(10));' which cache my results, but it seems the lifetime
> is not taken into account by my Zend\Storage\Memcached.
>

This was actually tested/implemented in
https://github.com/doctrine/DoctrineModule/pull/345 - maybe a bug?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] [Doctrine] Cache in use

2014-03-18 Thread Marco Pivetta
The fastest way to see if your cache is set, is checking your ORM
configuration:

$entityManager->getConfiguration() contains all the details that you want
to check.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 18 March 2014 12:09, LEROUX Jean-Marie  wrote:

> Hello,
>
> I configured Doctrine ORM module to use Memcached.
>
> Is there an easy way to verify that the cache is correctly used ?
>
> With ZF dev tools for example ?
>
> Thanks,
>
> JM Leroux
>


Re: [fw-general] Almost ready for 2.3.0!

2014-03-13 Thread Marco Pivetta
As reported in https://github.com/zendframework/zf2/issues/5963, the
subtree split script is NOT working correctly. I'd suggest avoiding
upgrades until this isn't fixed.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 13 March 2014 11:50, Norbert Máté  wrote:

> Something is wrong. All my tests fail except those ones that are for the
> base module that sets up the translator.
> The problem is the same:
> Zend\Mvc\Exception\BadMethodCallException: Unable to call method
> "setLocale"; does not exist in translator
>
>
> So I have these in my base modules onBootstrap:
> $translator = $e->getApplication()->getServiceManager()->get('translator');
> $translator->setLocale('en');
>
> This is working if I visit the site in a browser however when I run the
> unit tests it does not.
>
>
>
>
> On 12 March 2014 22:00, Ralf Eggert  wrote:
>
> > Hi Matthew,
> >
> > > As such, the above example would not have worked at any time in the 2.2
> > series.
> >
> > Sorry, my mistake. The code snippet had the wrong use statement. It
> > should have been:
> >
> > use Zend\Mvc\I18n\Translator;
> >
> > Thanks and best regards,
> >
> > Ralf
> >
> > --
> > List: fw-general@lists.zend.com
> > Info: http://framework.zend.com/archives
> > Unsubscribe: fw-general-unsubscr...@lists.zend.com
> >
> >
> >
>


Re: [fw-general] ZF2 development visualization

2014-03-12 Thread Marco Pivetta
This is generated via gource - you can usually run it against any vcs ;-)
On 12 Mar 2014 11:27, "jmleroux"  wrote:

> A little bit off topic...
>
> I don't know how to do this for ZF2, but this could be a good publicity
>
> https://www.youtube.com/watch?v=NMjA5N7kbEQ
>
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-development-visualization-tp4661846.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Almost ready for 2.3.0!

2014-03-12 Thread Marco Pivetta
On 12 March 2014 09:48, Norbert Máté  wrote:

> Now I can't update zf2 using composer.
> I didn't change anything in the composer.json. Yesterday the update worked.
>

Hey Norbert,

Github had serious hiccups yesterday, so it may be that. You can either
retry with `--prefer-dist` or just increase the timeout if your connection
is slow.

This is surely not a ZF issue

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] ZF2, Doctrine 2, and Composer autoload class redeclared error.

2014-03-11 Thread Marco Pivetta
On 7 March 2014 21:10, John Wynstra  wrote:

> I am experimenting with Doctrine 2 in ZendFramework 2 and am getting the
> following error:
>
> PHP Fatal error:  Cannot redeclare class Application\\Entity\\articles in
>
> ../../ZendSkeletonApplication/module/Application/src/Application/Entity/articles.php
> on line 8
>

This looks like a typo of some kind. The information provided is
insufficient to debug the problem, though.

Could you provide a gist with the file paths, autoloader config and file
contents of the class?


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


[fw-general] Re: Registering module event listeners early in the stack

2014-03-10 Thread Marco Pivetta
Hi Mark,

Attaching earlier than `onBootstrap` is only possible via `init`, and even
there, it would still be skipping some of the module loading related events.

What you can (eventually) do is something quite hacky, which is re-defining
the Application class so that it actually registers listeners during
`Application::init()`, and not during module loading.

I'd actually say that we can make that optional by allowing end users to
redefine their `index.php` (instead of using dirty hacks)

Cheers,


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 10 March 2014 18:42, moderndeveloper [via Zend Framework Community] <
ml-node+s634137n4661804...@n4.nabble.com> wrote:

> I'm working to get Zend Developer Tools to set a "universal" event
> listener for profiling of triggered events. I've gotten the code to 
> work<https://github.com/zendframework/ZendDeveloperTools/pull/142>,
> but with it being attached in the onBootstrap(), it's attached after
> several events have already fired. The listener is a
> SharedListenerAggregateInterface class that is being instantiated via the
> service manager based on a config option.
>
> Is there a way to actually get this attached earlier than onBootstrap? As
> far as I can tell, init() only has access to the ModuleEvent where I can
> get the event manager, but no the configs or service manager. Am I missing
> anything?
>
> --Mark G.
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Registering-module-event-listeners-early-in-the-stack-tp4661804.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Registering-module-event-listeners-early-in-the-stack-tp4661804p4661805.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] ServiceManager can't find 'Config' service.

2014-02-27 Thread Marco Pivetta
On 27 February 2014 21:01, Philip G  wrote:

> On Thu, Feb 27, 2014 at 11:48 AM, Marco Pivetta wrote:
>
>>
>> On 27 February 2014 20:37, Philip G  wrote:
>>
>>> I'm creating a new ServiceManager instance and a abstract_factory
>>> instance
>>> is failing to load.
>>>
>>> Found out the root of the issue is $services->has('Config')  fails within
>>> Zend\Db\Adapter\AdapterAbstractServiceFactory::getConfig() line number
>>> 71.
>>>
>>
>> That is normal - such a factory was thought to be used in the context of
>> a standard ZF2 Zend\Mvc based application
>>
>
> Ah. Then abstract_factory should be moved into Zend\Mvc, or
> zend-servicemanager needs to become non-dependent on Zend\Mvc auto-sets.
>

Not really. That abstract factory just relies on a "Config" service (that
is an array or ArrayObject) - it does not depend on Mvc components.



>
>
>
>>
>> I would have assumed new ServiceManager(new Config()); would have
>>> automatically set the Config service to the Config I passed in ...
>>> apparently, it does not.
>>>
>>>
>> Automagic is not a good idea here ;-)
>>
>
> I can get that. But, I'm intentionally using Zend\ServiceManager and
> Zend\Db conjointly for this functionality. It shouldn't be assuming I'm
> using it within context of Zend\Mvc, a non-explicit dependency.
>
>
No, the only assumption is that there is a "Config" service. It's a fairly
simple assumption, and easy to fix. Factories are scrap code, they rely on
other services and are in general not nice. Moving this factory to Zend\Mvc
brings no real advantage IMO.


>
>
>>
>>
>>
>>> One solution is to add this line, within
>>> Zend\ServiceManager\Config::configureServiceManager():
>>> --
>>> $serviceManager->setService('Config', $this->config);
>>> --
>>>
>>> However, I'm unaware of the implications to that. 'Config' is obviously
>>> being set somewhere else for abstract_factory to pass unit tests. But
>>> where? I'm running a very slim-down, component-by-component, based app; I
>>> only import zend-servicemanager, zend-db, and zend-http.
>>>
>>>
>> The "Config" service is usually defined by Zend\Mvc:
>> https://github.com/zendframework/zf2/blob/df6fa23483c990f3ac47400f7191a337d979b5ac/library/Zend/Mvc/Service/ConfigFactory.php
>>
>> The factory is registered in the ServiceListenerFactory:
>> https://github.com/zendframework/zf2/blob/df6fa23483c990f3ac47400f7191a337d979b5ac/library/Zend/Mvc/Service/ServiceListenerFactory.php#L44
>>
>> Cheers,
>>
>>
>>
> So, what happened is Zend\ServiceManager has became dependent on Zend\Mvc.
> Oops! Looks like some work needs to be done within Zend\ServiceManager. ;)
>

No, it's not up to the ServiceManager to define services. The service
manager is an empty box once shipped.


>
> I am 100% properly creating a new ServiceManager instance, without any
> conflicts or issues within any other component of ServiceManager.
> abstract_factory should to be updated so that it, too, isn't dependent on
> Zend\Mvc.
>

As specified above, it depends on a service, not on a component.

>
> I'll look into it, too, but this is a new piece to me I just discovered
> today -- seemed to fit my needs (I have 3 different db adapters I need to
> manage ... owie!). And I don't know all the potential implications or
> thought-process around the design decisions for abstract_factory. At the
> base, abstract_factory needs to become config aware upon
> $sm->addAbstractFactory().
>
>
Not sure what you mean here...




Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] ServiceManager can't find 'Config' service.

2014-02-27 Thread Marco Pivetta
On 27 February 2014 20:37, Philip G  wrote:

> I'm creating a new ServiceManager instance and a abstract_factory instance
> is failing to load.
>
> Found out the root of the issue is $services->has('Config')  fails within
> Zend\Db\Adapter\AdapterAbstractServiceFactory::getConfig() line number 71.
>

That is normal - such a factory was thought to be used in the context of a
standard ZF2 Zend\Mvc based application

I would have assumed new ServiceManager(new Config()); would have
> automatically set the Config service to the Config I passed in ...
> apparently, it does not.
>
>
Automagic is not a good idea here ;-)



> One solution is to add this line, within
> Zend\ServiceManager\Config::configureServiceManager():
> --
> $serviceManager->setService('Config', $this->config);
> --
>
> However, I'm unaware of the implications to that. 'Config' is obviously
> being set somewhere else for abstract_factory to pass unit tests. But
> where? I'm running a very slim-down, component-by-component, based app; I
> only import zend-servicemanager, zend-db, and zend-http.
>
>
The "Config" service is usually defined by Zend\Mvc:
https://github.com/zendframework/zf2/blob/df6fa23483c990f3ac47400f7191a337d979b5ac/library/Zend/Mvc/Service/ConfigFactory.php

The factory is registered in the ServiceListenerFactory:
https://github.com/zendframework/zf2/blob/df6fa23483c990f3ac47400f7191a337d979b5ac/library/Zend/Mvc/Service/ServiceListenerFactory.php#L44

Cheers,



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


[fw-general] Re: customize ZF2 ?

2014-02-24 Thread Marco Pivetta
On 24 February 2014 20:14, Mr User [via Zend Framework Community] <
ml-node+s634137n4661742...@n4.nabble.com> wrote:

> that's the catch i wont to remove the vendor directory i find it some how
> messy
>

You should get used to it, that's how "all the cool kids" are doing it
nowadays...


>
> ok let's start again
>
> i want in my /var/ directory to have things like this
>
> config  data  composer init_autoloader.php module
>

You want to rename "vendor" to "composer"? That's gonna break stuff for no
reason. You can do that though: see
https://getcomposer.org/doc/04-schema.md#config (vendor-dir)


>
> and inside composer i just want these files
>
> autoload.php  autoload_classmap.php  autoload_namespaces.php
>  autoload_psr4.php  autoload_real.php  ClassLoader.php
>

It will also contain the dependencies, not just those files...


>
>
> and my /var/www will be the public directory
>

You should really use symlinks or vhosts instead of replacing /var/www
directly


>
> and of course the zend library is in /usr/includes
>

That is super-confusing :O


>
> but for some reason i wasn't able to do that
>

Yeah, because the skeleton app is not meant to do that. It's still a
skeleton app though, so you can manipulate it as it pleases you.


I still miss your point though - why is this being done? What's the
rationale? The current structure comes from a lot

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661743.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: customize ZF2 ?

2014-02-24 Thread Marco Pivetta
Argh, sorry, my mistake.

I meant to tell you to customize init_autoloader.php (
https://github.com/zendframework/ZendSkeletonApplication/blob/2f60f8af002e6b7afc9f47a5e79e038e0baf5e3a/init_autoloader.php),
and instead I wrote "autoload_namespaces.php".

Do not edit ANYTHING within "vendor" ;-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 24 February 2014 19:09, Mr User [via Zend Framework Community] <
ml-node+s634137n4661740...@n4.nabble.com> wrote:

> well that's what i thought but when i do edit the file and make it like
> this
>
> 
> // autoload_namespaces.php @generated by Composer
>
> $vendorDir = dirname(dirname(__FILE__));
> $baseDir = dirname($vendorDir);
>
> //return array(
> //'Zend\\' => array($vendorDir .
> '/zendframework/zendframework/library'),
> //);
>
>
> return array(
> 'Zend\\' => array(getenv('ZF2_PATH')),
> );
>
>
> i loose everything even if the ZF2_PATH is registred in my path to the
> zend library i don't understand why ? i have read the source code of the
> files but i can't seem to know why the composer autoloader failed to charge
> the freamwork when i do change the zend library path
>
>
>
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661740.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661741.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: customize ZF2 ?

2014-02-24 Thread Marco Pivetta
On 24 February 2014 18:19, Mr User [via Zend Framework Community] <
ml-node+s634137n4661738...@n4.nabble.com> wrote:

> first of all thank you for the info but any way even if you have a website
> you will not upgrade it each time it will be some how time consuming
>
>
Yes, but we can't run away from that - parch releases are designed to
handle that.


> well i tried what you saied but it dosn't work in fact i changed the
> `autoload_namespaces.php` so that i will point to the zend library but for
> some reason it dosn't work
>
>
Well, if you use composer's autoloader, that one is going to be dictating
that ZF2 comes from somewhere inside `vendor`. You can't really edit
ANYTHING without `vendor`, since that's composer's domain (no touching!).

Instead, customize your `autoload_namespaces.php` by registering your own
autoloader manually. You can just edit that file, no problems.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661739.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: customize ZF2 ?

2014-02-23 Thread Marco Pivetta
On 23 February 2014 23:18, Mr User [via Zend Framework Community] <
ml-node+s634137n466173...@n4.nabble.com> wrote:

> well as i said before there is  actually no raison at all it's just i wont
> it to be like that


That's how we used to code with PEAR dependencies, which were system-wide.
It works, but it will bite you back.


> i don't even think that there will be some kind of security application


The security implication is that multiple apps share the same codebase from
`/usr`, and you may not be able to upgrade without upgrading all apps that
reference it. If you have a security issue you should be able to upgrade
ASAP ;-)


> because let's be honest to move a directoryto /usr only mean that you are
> the root of the system


Yes, the problem is sharing the codebase across multiple installations.


> so i don't know what's are you trying to say but any way if you don't wont
> replay just say it no one will tell why ?


> it's by fighting the freamwork that you will learn more
>

Agreed on that, I hope I made my point clear.

You can put ZF2 wherever you want as long as you export the "ZF2_PATH" var
environment setting correctly - it just is almost never needed, if not
harmful.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661736.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: customize ZF2 ?

2014-02-23 Thread Marco Pivetta
On 23 February 2014 16:11, Mr User [via Zend Framework Community] <
ml-node+s634137n4661732...@n4.nabble.com> wrote:

> no reason at all i just heat this default instalation i would like to do
> things in my own way i hope that's a good reason for you
>

Nope, not good enough as a reason :-)

There's a motivation behind having per-repo packages, and that's
maintainability, upgrades and security.

Why are you trying to move your repo to `/usr/`?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661733.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: customize ZF2 ?

2014-02-23 Thread Marco Pivetta
On 22 February 2014 21:32, Mr User [via Zend Framework Community] <
ml-node+s634137n4661729...@n4.nabble.com> wrote:

> Hello everyone
>
> ok let's go strait to the point so i want to customize my ZF2 instalation
> but i couldn't find any kind of documentaion so let me tell you first what
> i did
>

What exactly do you mean by "customize my ZF2 instalation"? What is being
changed?


> i installed the ZendSkeletonApplication correctly and everything was good
> i was able to view the index page from my browser so i wanted to change the
> zf2 library location and i changed it to /usr/ZF2


You are not supposed to do that anymore. Global library installations is a
bad idea in most cases - ZF2 allows you to do that, but you must have
strong reasoning to actually apply that.


> after that i changed my httpd.conf by adding  SetEnv ZF2_PATH /usr/ZF2 and
> of course also my include_path in php.ini and i again i was able to view
> the index page so i said i should now remove vendor directory which i
> wanted in the first place one i did that nothing seem to work i opened the
> init_autoloader.php and guess what the probleme is in this 2 lines
>
> if (file_exists('vendor/autoload.php')) {
> $loader = include 'vendor/autoload.php';
> } ==> it was autoloading
>
> i copied back my vendor directory so that i can study where do autoloading
> need this vendor directory and it seems that it does need it heir
>
> // autoload_namespaces.php @generated by Composer
>
> $vendorDir = dirname(dirname(__FILE__));
> $baseDir = dirname($vendorDir);
>
> return array(
> 'Zend\\' => array($vendorDir .
> '/zendframework/zendframework/library'),
> );
>
>
> the probleme is whenever i try to change the array so that it will pont to
> my new library location the zf2 breakdown but when i channged back
> everything work
>

That is normal, composer is not designed for global includes


>
> So now the questions ?
>
> 1-can someone plz explain to me why this is happening
>

Composer installs dependencies per-project.


> 2-can you plz tell me how to get ride of this vendor directory
>
>
You shouldn't. I would help you on that only if I had an exact reasoning on
why you are trying to do that.



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/customize-ZF2-tp4661729p4661731.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Where to place template files in ZF2?

2014-02-19 Thread Marco Pivetta
You can probably just use the standard "view" structure for ZF2 - you would
just need a different template resolver instance for it.



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 19 February 2014 19:11, dennis-fedco  wrote:

> Say I have a module that uses existing PDF files to produce new PDF files.
> Existing PDF files are therefore templates I can use to draw new stuff on.
>
> Where do I put those template PDF files in the ZF2/module's folder
> structure?
>
> I thought of putting them into ./data, but then they will go into the
> global
> application scope, and I am not sure if that's the best practice when only
> one module uses these and is therefore affected by them (so far).
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Where-to-place-template-files-in-ZF2-tp4661715.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] Re: E-mail module for ZF

2014-02-15 Thread Marco Pivetta
Hi Mat,

Does your module also work with the normal view helpers? Didn't check in
depth, but it seems to me like you are using only custom plugins with your
own interface.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 14 February 2014 18:06, mtymek [via Zend Framework Community] <
ml-node+s634137n4661685...@n4.nabble.com> wrote:

> Hi everyone!
>
> I wrote a module that handles e-mail creation and sending. It uses
> Zend\View for rendering message templates. It has a few useful features
> like layouts, or auto-generated plain text messages. It is pluggable,
> meaning that you can easily customize how messages are created. Factories
> for default ZF mail transports are included.
>
> Right now I'm about to tag version 1.0, but before doing so, I'd like to
> get some feedback.
> So, what are the features that you'd see in a perfect e-mail module? Would
> MtMail work for your application?
>
> Thanks!!
>
> Link: https://github.com/mtymek/MtMail
>
> cheers,
> Mat
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/E-mail-module-for-ZF-tp4661685.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/E-mail-module-for-ZF-tp4661685p4661690.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Pass through routing

2014-02-07 Thread Marco Pivetta
On 7 February 2014 02:20, mont0165  wrote:

> I have a three-tier system.
> tier 1 = UI
> tier 2 = 'aggregation layer' ZF2
> tier 3 = 'core services' ZF2
>
> The agg layer is a way to fold in client specific 'stuff' without polluting
> core services.
>
> In many cases, the agg layer will NOT be adding additional features, so it
> simply passes everything along to core services and then passes the
> response
> of the core services up to the UI tier.
>
> I have a lot of bloat code that takes what the ui posts and passes it to
> core.  I want to avoid this if I can and have the request go right to core.
>
> Question:
> Rather than coding a Controller that passes the same request on to core
> services and then passes core service's response back to the UI, is there a
> way either through Bootstrap or my routing config to pass certain url
> patterns directly to core?
>
> So when UI posts to 'http://myclient.mydomain.com/member/add, zend reviews
> the url pattern, sees that the agg layer doesn't have any additional client
> specific tasks to execute and posts the same request to
> core.mydomain.com/member/add
>
> Thanks in advanced!
>
> Monty
>

Zend\Http\Client is in fact a Zend\Stdlib\DispatchableInterface instance,
therefore you should be able to simply define a controller being a
pre-configured Zend\Http\Client instance.
That should do the trick.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Rasmus Lerdorf opinion on PHP frameworks: "They all suck!"

2014-02-06 Thread Marco Pivetta
On 6 February 2014 14:59, Greg  wrote:

> My first impression is that the route event should only return a route
> matched (SRP?); its simpler and would allow the route match to be retrieved
> from the service manager without needing a route event (or if there is no
> matched route). The service manager could then have a default route match
> configured, 404 ?.
>

Gosh, no!
This is totally off-topic, please don't drag discussions about further
development here :P


Re: [fw-general] Caching on a ZF 2 / Doctrine 2 application

2014-02-06 Thread Marco Pivetta
If you work with the current "master" branch of Doctrine ORM, the ORM
itself provides a feature called "Second Level Cache" (or SLC or L2 Cache).

Doctrine ORM 2.5 will be released soon with this feature, you may read more
about it at
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html

If you cannot use 2.5 (master) right now, you may check
http://stackoverflow.com/questions/15661296/doctrine-2-and-orm-how-to-cache-every-query-for-some-entity-
yes, that's a lot of manual work.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 6 February 2014 13:24, Christian Ebert  wrote:

> Hi,
>
>
>
> I am working on a ZF 2 / Doctrine 2 based application with a traditional
> relational MySQL backend. I am trying to figure out how to effectively add
> a
> caching layer. Concrete I am searching for a solution how to handle
> associations effectively. That means if an entity changes e.g. username of
> a
> user, I need to expire all related caches where the user is used. As it is
> a
> write intensive backend solution, I cannot specify a fixed amount of time
> when the cache should be expired. Moreover I need to expire the caches
> immediately when the related data changes.
>
>
>
> Is there any clever recommendation how to implement this or is the best
> solution to manually define relations between caches and used entities. Of
> course manual management of relations is not preferred as this is always
> subject to be forgotten when entities advance.
>
>
>
> Best Regards
>
> Chris
>
>
>
>
>
>


Re: [fw-general] Rasmus Lerdorf opinion on PHP frameworks: "They all suck!"

2014-02-06 Thread Marco Pivetta
On 6 February 2014 00:57, franz de leon  wrote:

> reading the article, it made me think about routing that it is indeed
> pretty costly. what do you think of an adapter in zf2 that would actually
> generate .htaccess (mod rewrite) files as a feature? in production this
> will work in a caching way to step over the php routing logic.
>

Routing is still a feature that the framework should handle. There's a
couple of things going on here:
 - if routing is managed by different files, you end up having multiple
application entry points (duplication)
 - routing is no big performance deal, and DASPRiD is even working on
making it faster even if it usually accounts for less than 5% of the page
load time
 - moving routing to files denies custom routes, which is the real power of
a router. Routing is not just a pattern matching mechanism, you can plug
any logic into a route. People tend to throw "not found" exceptions in
controllers - I think that is a mistake.
 - moving routing out of your application requires your developers to have
more knowledge about the environment the application runs in, and reduces
portability
 - moving routing out of your application makes changing routes assembling
across your application a nightmare, requiring you to manually change a lot
of paths whenever it is happening.

So yeah, seems like the usual "squeeze performance out of it" for no big
benefit.
I had this discussion before with people that highly value performance, and
I still think caching is the way to go here, instead of trying to split
tasks among different in-homogeneous tools.

If your app is THAT application critical for some paths, then you just
rewrite your varnish config in order to deal with routing in THAT
particular edge case, maybe serving the response from a load balanced tree
of machines or a dedicated micro-service built with C or something  like
that :P

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Rasmus Lerdorf opinion on PHP frameworks: "They all suck!"

2014-02-05 Thread Marco Pivetta
On 5 February 2014 22:49, Thomas D.  wrote:

> Hi,
>
> Rasmus Lerdorf, the PHP creator, was invited to give a talk in PHP
> Frameworks Day conference.
>
> He talked mostly about the latest PHP developments, but in the
> question and answers section, somebody asked Rasmus about his opinion
> on the PHP frameworks. That was as straight question about his
> opinion, so Rasmus gave a straight answer (near 31m 47s): "They (PHP
> frameworks) All suck!"
>

> It may seem odd that a guest speaker goes to a PHP frameworks
> conference telling all of them suck. However, the audience seemed to
> have enjoyed the answer. Anyway, Rasmus went into more detail about
> what he meant.
>
>
He used those terms just to cause a bit of fuss and make the audience
"shake" a bit. That's what talks at a conference are for: informing and
entertaining. After all, he's the first guy building custom PHP extensions
for Yahoo, causing quite some issues there as it seems (
http://news.php.net/php.internals/71735 - making PHP internals his own
framework).

He didn't just plainly say "sucks". Yes, most "full-stack" frameworks are
solving more problems than what we need to be solved, and that's why we go
modular with everything nowadays.

I still personally prefer the full-stack approach because my use case is
not scalability and high concurrency, but complex business problems for
enterprise customers. These people don't care about how fast a system goes,
rather than how well a problem is solved, how much it will cost to maintain
the solution and how many bugs and security issues may be involved with it
in the future.

You can't know any of those  for sure, but a framework usually gives you a
better ground to build a solid application, while the plain language
usually requires a highly skilled developer to achieve that.

To make an example, a house could be built with modular components that get
shipped in a single shot and assembled in one or 2 days (yes, that already
happens in many northern european countries) or it can be built over time
with bricks and carpenters and so on.

Each solution has advantages and disadvantages, but one solution is more
automated and the other more customized. On one home, you get 30 years of
warranty, on the other one, you must fix it yourself.

The same applies to software: you built it custom? Now it's your problem.
It will be your problem also with frameworks if you don't keep up with
upgrades, though.

I'd add that speed is usually achieved by NOT letting PHP execute your code
(regardless of framework/non framework solution), but by caching the hell
out of it and building your architecture correctly.

At the end of the day, a clean architecture wins the "war" on
maintainability, performance and security. If you are a kickass pro
super-duper-uber architect, and you can build your custom "house" because
you planned every detail upfront: then you can go on and build everything
from scratch, but beware that I know probably a dozen of these people.

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: ZfcAdmin

2014-02-05 Thread Marco Pivetta
On 5 February 2014 12:36, dolphin  wrote:

> > What kind of functionality would you need?
>
> https://github.com/sonata-project/SonataAdminBundle
>

That's out of scope for ZfcAdmin, since ZfcAdmin follows a much more
minimal and simpler idea of simply providing a default navigation container
by name.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: ZfcAdmin

2014-02-05 Thread Marco Pivetta
On 5 February 2014 11:39, dolphin  wrote:

> And what if we extend this functionality?
>

What kind of functionality would you need?


> Newcomers ask "how to write modules for ZfcAdmin ?" :))).
>

Modules "for ZfcAdmin" just add navigation pages to it, nothing else


> Perhaps it makes sense to add some CMF functionality to ZfcAdmin?
>

ZfcAdmin has nothing to do with that


> We all know that these *BUNDLES* :)))  can be very useful. And they are
> very
> popular.
>

Yeah, but the scope should be small and well defined.


> I can easily change the namespace of my module, but I know that there may
> be
> objections, clarify, proposals. Therefore, I propose my module as a
> prototype.
>

What does your module do? And why would it replace ZfcAdmin?


> What do you think?
>

Well, I honestly don't know, because your questions are not very clear.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] ZfcAdmin

2014-02-05 Thread Marco Pivetta
ZfcAdmin is pretty much stable - it does only provide a standard navigation
container where to attach items, not much more...

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 5 February 2014 08:28, dolphin  wrote:

> Hi. I would like to know at what stage of development module ZfcAdmin?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZfcAdmin-tp4661605.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Zend\DI: Use concrete class instead of interface everywhere

2014-02-05 Thread Marco Pivetta
Hey there!

On 5 February 2014 10:58, Anton Serdyuk  wrote:

> Hi, folks!
>
> There is some problem I can not solve. I have some code which I want to
> wire up with zend-di. There are many classes which have constructor
> parameter lets say UserRepository $userRepository.  UserRepository is an
> interface, and there is DoctrineUserRepository. So I want somehow tell to
> di-container it should use DoctrineUserRepository instead UserRepository
> every time. For example I want sometimes call $di->get('UserRepository') or
> I can make it as constructor parameter to another class - it doesnt matter.
>


That's a fairly common use case: you will need to set a "preference" for
the DI container. Something like following:


'instance' => array(
'preference' => array(
'Zend\EventManager\EventManagerInterface' => 'EventManager',
'Zend\ServiceManager\ServiceLocatorInterface' =>
'ServiceManager',
),
),



That will do the trick, and will tell the container to use "EventManager"
(or whatever concrete class name) whenever the interface for it is used.

I think there's also some more about it on
http://ocramius.github.io/blog/zend-framework-2-controllers-and-dependency-injection-with-zend-di/

Cheers,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] ServiceLocator in Model classes - Error: Call to a member function get() on a non-object

2014-02-02 Thread Marco Pivetta
Hi there,

On 30 January 2014 22:32, erkinaka  wrote:

> i want to get a param from module.php in any model but i have the error
> above.


Are you really really really sure that you need that parameter into your
model? Shouldn't it fit the services that manipulate the model instead?


> What is the solution. i try all the solutions in form but i couldn't
> solve
>
> my module.php
>
>   public function getServiceConfig()
> {
>
> return array(
> 'factories' => array(
>  'adapter1' => function ($sm) {
> $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
> return $dbAdapter;
> },.
>
> my model
>
> namespace Sorubankam\Model;
>
>
> use Zend\Db\Sql\Select;
> use Zend\ServiceManager\ServiceLocatorAwareInterface;
> use Zend\ServiceManager\ServiceLocatorInterface;
>
> class CustomCls implements ServiceLocatorAwareInterface
> {
>   protected $services;
>
>
>   public function setServiceLocator(ServiceLocatorInterface
> $serviceLocator)
> {
> $this->services = $serviceLocator;
> }
>
> public function getServiceLocator()
> {
> return $this->services;
> }
>
>   public function deneme()
> {
> $adapter=$this->services->get("Sorubankam\Model\CustomCls"); /*
> Error line */
>

A model is not coming from the service manager, and if it is, then
something is wrong/fishy.

Only services that are created from a service manager that has an
initializer for `ServiceLocatorAwareInterface` instances will inject that
instance into newly spawned service instances.

You can


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: Zend\Db COALESCE

2014-02-01 Thread Marco Pivetta
Yep, the "issue" tracker is indeed used also to track what is being
requested as new feature

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 1 February 2014 19:43, dolphin  wrote:

> Prompt please, it must be a "issue"?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Db-COALESCE-tp4661579p4661581.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Zend\Db COALESCE

2014-02-01 Thread Marco Pivetta
Open a feature request at https://github.com/zendframework/zf2/issues

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 1 February 2014 19:30, dolphin  wrote:

> Are you planning to create a Zend\Db function COALESCE?
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Db-COALESCE-tp4661579.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Why ZF2 uses Routes?

2014-01-28 Thread Marco Pivetta
Routing is not just some pattern matching. What is different from using
different files to handle routing and a centralized router/dispatcher is:

 - centralized bootstrapping
 - code duplication removal
 - being able to plug custom logic per URI (not just physical paths, may be
logical paths computed through a map, for example)

In general, where you'd have the filesystem as a "map" of your application
logic, you now have the equivalent `function route($url);`, which is more
powerful given that you can plug any logic into that step.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 29 January 2014 04:28, dennyamd  wrote:

> Aside from SEO and perhaps URLs looking pretty, are there any arguments for
> using Routes?
>
> I am talking about:
> * localhost/path/file.php?item1=value1&item2=value2 vs
> * localhost/controller/value1/value2
>
> I apparently missed that transition period of the Internet.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Why-ZF2-uses-Routes-tp4661553.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] ZF2+Doctrine2 | Sharing entities between modules, impossible??

2014-01-26 Thread Marco Pivetta
On 26 January 2014 19:06, Absalom  wrote:

> Hi everyone, I've been searching for an answer and experimenting for a
> whole
> day now. Enough is enough! =)
>
> Simply put, I have two modules; The main Application module which holds a
> User entity and a second one, Auth, for authentication and registration
> that
> tries to make use of this entity. Since I obviously don't want the two
> modules to be dependent on each other I'd like the Auth module to try to
> use
> its own (non-existing) entity "Auth\Entity\User" but this should be
> overridden by the application to "Application\Entity\User".
>

You can use a config flag for that. ZfcUser allows defining what the entity
class would be, for example.

'my_super_cool_module_user_entity_class' => 'MyStuff\User',



> The first case where I try to use the Application modules User entity from
> within the Auth module is when registering and a new User should be
> created.
> Here I have to create a new instance of User and to be able to override it
> I
> use the ServiceLocator, so that I can register an invokable on application
> level, pointing "Auth\Entity\User" to "Application\Entity\User". This
> works,
> but is this really the way to do it?
>

No, the service manager is only supposed to instantiate SERVICES, never
ever ever ever use it to instantiate anything that isn't a service.
Newables should live outside the container. I usually refer to
http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/ when discussing
that.

You can ask the implementor to provide a service that has a "createUser"
method in its public interface. That hides any instantiation logic and
allows the end user to retain control over how a user should be created,
removing a lot of problems that you may find when dealing with constructor
params or required injections (although "required" setter injection is a
stupid idea, some people do that).


> The second case is when I try to login a user. For simplicity sake there's
> no AuthenticationService involved now, I simply fetch the User from it's
> repository using the email. This is where I'm totally stuck. I'm tring to
> use $entityManager->getRepository('Auth\Entity\User'),


Get the repository injected. Define it as a service in your module and
allow the any module implementor to override that service.


> But it seems
> impossible to override this on application level to
> "Application\Entity\User". I've tried all sorts of configurations in
> global.config.php and even directly in the Auth modules config-file to tell
> it to use the Appllication Entities but nothing works.
>

You can just rely on an interface and then use a Doctrine2 listener for the
`loadClassMetadata` event of the ORM to replace any reference to that
interface to the real entity name.


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: ZF2 "dispatch.pre"

2014-01-24 Thread Marco Pivetta
On 24 January 2014 15:19, dolphin  wrote:

> "Content" gives the main controller. He attaches the child model to Layout
> ViewModel as "content". Then automatically generated widgets. With the help
> of "forward". Theme detector should detect "dispatch" of main controller.
> All other "forward" - is the formation of widgets. The detector should only
> work once, for the main controller. And apply the theme. Backend theme. Or
> frontend theme...
>
> But the biggest problems do not begin when the layout is generated
> automatically. They start when the main controller itself for any purpose
> carries "forward". This was not at all like to think ...
>

 If I get it correctly, you are misusing "forward" to assemble a complex
view model. Doesn't seem like that's the right way to do it.

Also, can you provide some context/links to current code? It is really
really hard to follow your train of thought without some actual code
reference to who/what is doing things...

What exactly is the unexpected behavior that you are experiencing when
using the forward plugin? (also, I avoid it like the pest in most cases,
since it does a lot of pretty much useless magic)


Re: [fw-general] Re: ZF2 "dispatch.pre"

2014-01-24 Thread Marco Pivetta
The "Theme" would be the so-called layout, as far as I get it.
You can handle layout changes by either listening to the `dispatch` event
with very low priority (since theming should happen _AFTER_ dispatching) or
in the `render` event (with very high priority).

EdpModuleLayouts is a nice example of how that flexibility comes into place.

So now I'm wondering why you'd handle theming _before_ `dispatch` (in a
`dispatch.pre`)



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 24 January 2014 14:31, dolphin  wrote:

> I will try obsnit short sentences . So it will be clearer. Imagine that you
> are building a dynamic layout . Not like in zf1 (with helpers), but using
> "dispatch". You are using a theme. But not a single module , and a set . As
> Drupal . You have a theme for frontend .  You have a theme for the backend
> .
> And you have a theme for installation. Additionally there are modules
> widgets. Them too much.
> Question: how to determine what as theme should be use at the moment?
> I am repelled by the system that offers zf2 . It is ViewModel . It is
> "dispatch" method.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-dispatch-pre-tp4661523p4661531.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: ZF2 "dispatch.pre"

2014-01-24 Thread Marco Pivetta
On 24 January 2014 14:01, dolphin  wrote:

> What do you think, I just like to come up with events that could exist in
> zf2?
>

No, I'm just asking for a more precise reason why such an event would exist.


> I think if someone asks a question, this is necessary.
> I would not be surprised if at some godforsaken forum hear "you do not need
> it."


Telling people YAGNI is pretty much 50% of my Github activity. I reject a
lot of pull requests, patches and feature requests because of that, and it
is a very important thing to do. Not everything should be accepted without
a good use case for it.


> If you want me to not use zf2, say so now.
>

Never said that, don't be so "defensive" - I'm just trying to destabilize
your theory that a new event is needed to see if you can actually see a
workaround to it


> As for my case:
> https://github.com/dphn/ScContent
>

Can you point me to the exact location where/why you'd need the event?


>
> Regardless of whether you like this code or not, it's part of the business

logic of my system.
>

It's not a matter of "liking" it or not. I just push my thought forward and
say "heeeyyy, wait a sec - maybe you can just re-think something?".


Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


Re: [fw-general] Re: ZF2 "dispatch.pre"

2014-01-24 Thread Marco Pivetta
Test case or it didn't happen. No english needed at all :-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 24 January 2014 13:43, dolphin  wrote:

> My particular case is part of the business logic of my application. I do
> not
> know English well enough to explain how it works and why it is needed. But
> it is a very real case.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-dispatch-pre-tp4661523p4661527.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Re: ZF2 "dispatch.pre"

2014-01-24 Thread Marco Pivetta
Can you please explain your use case? Why would you need another `.pre`
event? We already assured that it's a bad idea to have `.pre` and `.post`
events when we have priorities and can throw logic at a stack of listeners
instead...

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 24 January 2014 13:20, dolphin  wrote:

> Yes, thank you , I know these events . But I meant something else.
> At these events, another "target" - Application.
> As I've said , "dispatch" in reality works as "dispatch.post".
> So I have to create a "capture" method  for the event MvcEvent ::
> EVENT_ROUTE.
> This method uses RouteMatch and ControllerManager  to pre-load the main
> controller .
> So I can emulate event "dispatch.pre".
> That is, my code does the same job as the framework. As a result - wet
> code,
> tangled code , low productivity .
> It looks just awful. Events are designed to avoid this .
> This is the reason for my interest.
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-dispatch-pre-tp4661523p4661525.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


Re: [fw-general] Doctrine "Closed Entity Manager"

2014-01-21 Thread Marco Pivetta
Either set the "shared" flag to `false`, or pass a factory down to your
service:

$myService = new MyService(function () use ($sm) { return
$sm->createService('Doctrine\ORM\EntityManager'); });

This saves you from having the SM bound to your service, and allows you to
use the callback as a "smart constructor"

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 21 January 2014 17:25, Bas Kamer  wrote:

> Hello,
>
>
> reading
> http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/transactions-and-concurrency.html#exception-handling
>
> Ok Fine... With a closed entity manager I should get a new entity manager
> if i want to work continue doing queries...
>
> What would be a good strategy to do that with the context of zf2 when the
> EM is injected via factories.
>
> About the only thing I can think of is setting the shared flag of the
> entity manager to false… This doen’t seem efficient as that would
> (re)create connections not for the exception case but always.
>
> Intend use is long running background processes - in which a closed entity
> manager really helpful
>
>
> Bas


[fw-general] Re: yaf and phalcon

2014-01-20 Thread Marco Pivetta
On 20 January 2014 19:03, moderndeveloper [via Zend Framework Community] <
ml-node+s634137n4661487...@n4.nabble.com> wrote:

>  Marco Pivetta wrote
> mac_nibblet (Antoine Hedgecock) has already tried zephir extensively to
> port the Zend\EventManager component for ZF3 as a C extension. The result
> was interesting, but still not good enough to justify the pains of
> debugging C code (yes, you still need to go into C code when using
> Zephir).
> The segfaults and bugs encountered were discouraging in my opinion.
>
> Well, testing pre-alpha can have that effect. Just went alpha 1 on Jan. 17.
>

Agreed, but I'm used to work with pre-release software most of my time -
the number of added troubles is simply not worth it for now.


>
> Marco Pivetta wrote
> Results were much better with HHVM and native PHP code.
>
> Is there somewhere that shows the results of this test, or was the
> EventManager never able to get up an running on Zephir? I know that HHVM is
> rocking fast, but how much faster? Could it actually make ZF2 faster than
> Phalcon? Will the intl extension be included soon?
>

The EVM was correctly built in Zephir, and Antoine got HHVM 2x faster than
it - results are on his computer though, I only saw them personally at
ZendCon Europe, so maybe he can try and release them. Yes, HHVM can make
ZF2 faster. The Intl extension is almost complete in HHVM as well.


>
> To the original poster, I've used ZF2 and Phalcon. Just to point out,
> Phalcon and Zephir are two different things. They are both being written by
> the same team, but you don't have to use or know both to use either.
> Phalcon is the framework just like ZF where you write plain-old PHP to
> create your application. The speed advantages come in that the framework is
> pre-compiled into C and loaded as a PHP extension. Your code still uses the
> regular PHP JIT compiler when run, so if you write slow code, it will still
> be slow code in a supper fast framework :-)


Aware of all this, but the argument is quite moot if the execution time is
not swallowed by the framework (which is not the case for me, for example).
Fixing architectural problems brings more performance gains than banging
them with a compiled version of the vendors.


> Zephir is the intermediate language where you could, theoretically right
> now, write ALL your userland code and have your entire application compiled
> to C and installed on the server as a PHP extension. I haven't done this
> and probably won't even try until Zephir is in late beta.
>

Yes, this is what has been done so far - it's just not worth it and it
reduces the number of people that can work on your code, as well as
portability.


>
> There are advantages to both frameworks.
>
> *ZF2 advantages*
> * ZF2 has a very large developer community using and updating the
> framework.
>

That's true for other FWs as well


> * ZF2 has a company behind it pushing dev forward.
> * ZF2 has many more helper/utility classes included in the full package to
> help you "do the right thing" in your code.
>

That's what a focus of a FW should be on - fixing what the users of the
framework usually don't fix (security, parsers, complex DSLs, some
architectural decisions, etc)


> * Packagist has tons of pre-made modules for different problems. Some of
> them rather good.


That's true for packages for PHP in general, not just ZF


>
> *Phalcon Advantages*
> * Speed
>

moot - fix your architecture first


> * Speed
>

moot - fix your architecture first


> * Did I mention speed? I haven't seen a benchmark yet that shows less than
> a 10x (not 10%, 10x) speed increase over

ZF2 even for the simplest Hello World script. The Phalcon micro
framework<http://docs.phalconphp.com/en/latest/reference/micro.html>
is
> even faster.


Did I mention that it's moot? Fix your architecture already! If you are
bombing the framework at every request on performance-sensitive apps and
you are not scaling or distributing things correctly, then you are doing it
wrong.

* It's much less "configuration as framework" while still allowing for a
> full dependency injection/services/events (DISE) style applications.
>

ZF2 is also like that when using it "standalone" (without skeleton app)


> Marco is right in that, if you want to get into the internals of Phalcon,
> you need to be a C programmer. If you are the type of developer who just
> wants to use the framework and just add bug reports when something is
> wrong, it's not that big an issue. There are only two main developers that
> do 99% of the programming, so you could have concerns about project
> longevity, etc. Then again, the same could be said for any software. They
> are extremely active 

Re: [fw-general] Questions on Naming

2014-01-17 Thread Marco Pivetta
On 17 January 2014 22:12, dennis-fedco  wrote:

> I've noticed that ZF2 has names like \Zend\Debug\Debug, and while there is
> some duplication here, it makes some sense.
>
> For example, working with BjyAuthorize I see some names that break up this
> structure. For example,
> BjyAuthorize\Provider\Role\ObjectRepositoryProvider.php
> <
> https://github.com/bjyoungblood/BjyAuthorize/blob/master/src/BjyAuthorize/Provider/Role/ObjectRepositoryProvider.php
> >
>

There is an issue for that:

https://github.com/bjyoungblood/BjyAuthorize/issues/66

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


[fw-general] Re: Zend\Di\Di configuration array?

2014-01-12 Thread Marco Pivetta
If you want, you can pick up my documentation work from
https://github.com/zendframework/zf2-documentation/pull/82, which is
unfinished. You can also look into
https://github.com/ralphschindler/Zend_DI-Examples

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 10 January 2014 23:15, Philip G [via Zend Framework Community] <
ml-node+s634137n4661438...@n4.nabble.com> wrote:

> On Fri, Jan 10, 2014 at 12:41 PM, Matthew Weier O'Phinney
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=4661438&i=0>>wrote:
>
>
> > The ServiceManager is far easier to configure, and much more
> > performant (though, as with just about any generalized component,
> > could be even better).
> >
> > If you are looking for an IoC container to manage DI for your various
> > services/instances, I'd recommend Zend\ServiceManager instead of
> > Zend\Di.
> >
>
> I was looking into that, but ran into a configuration snafu when I hit the
> DB component: I couldn't figure out a way to Lazy load PDO (requires a
> DSN)
> when the DSN is stored within the same file as the SM configuration. And
> SM
> Configuration doesn't have a built-in "config" pass. All that stuff is
> injected via Zend MVC, which I'm not using. DI doesn't really solve this
> either, but using a Proxy class could work ... maybe.
>
> My application is very simple: a single php tracking script. Reads in
> visits, deciphers their cookies, and makes a call to a DB or Web Service
> back end depending on parameters from their cookie.
>
> The basic requirements are:
>  - Speed
>  - Parsing and managing incoming and outgoing cookies.
>  - Ability to set content-type headers to either json or gif.
>  - Log to directly to DB or Web Services (or neither), depending on cookie
> parameters.
>
> zend-http resolves a number of these: it gives me PhpEnv.\Request and
> Response, as well as Http\Client for WS. My plan for DB was PDO directly
> (using pdo_cassandra).
>
> Now, I want this to be easily swappable for testability, and that's where
> I
> ran into the trouble. Naturally, you'd think DI and a DiC; however, DiC is
> notorious for not being speedy, unless configured (thus my config
> question). In addition, it's not a lazy loader, something I was toying
> with
> the idea of Proxy class for.
>
> ServiceManager would resolve the swapability of RequestInterface and
> ResponseInterface. But, I fell when it came to configuring for lazy
> loading. PDO requires a DSN, which is stored within the same config as SM
> values. And, I can't load PDO until I know "this request" is to be logged
> to the DB. WS is slightly less tricky: it's not as overhead dependent, and
> can be instantiated with no impact, and URL set at a later time.
>
> ---
> Philip
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4661438&i=1>
> http://www.gpcentre.net/
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Zend-Di-Di-configuration-array-tp4661430p4661438.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Di-Di-configuration-array-tp4661430p4661449.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: BjyAuthorize RuleProvider from Doctrine (help requested)

2014-01-12 Thread Marco Pivetta
Answers inline

On 11 January 2014 00:54, dennis-fedco [via Zend Framework Community] <
ml-node+s634137n4661439...@n4.nabble.com> wrote:

> I've been entangling myself in code, while trying to implement a
> RuleProvider to work with BjyAuthorize ZF2 module.
>
> I need a bit of help.  I put my code here for 
> reference<https://github.com/dennis-fedco/BjyRuleProvider>.
>
>
> I am looking for help in some specific areas.
>
> Some problems I am currently experiencing:
> *  FedcoUser/src/FedcoUser/Entity/ControllerGuardRule class - should it
> implement any Providers, like BjyAuthorize\Provider\Rule\ProviderInterface
> interface, or not?
>

Is it a rule? Then you should have a provider that returns a list of these
somewhere.

>
> I ask because it seems that I have
> FedcoUser/src/FedcoUser/Provider/Rule/ObjectRepositoryProvider that already
> implements Rule\ProviderInterface.  All in all, where, and how should I
> retrieve my rules?
>

If you implement the Rule provider interface on the repository, then you
don't need to go any further. Just register the provider with BjyAuthorize.


>
> *  My Doctrine mappings for ControllerGuardRule are out of 
> whack<https://gist.github.com/dennis-fedco/51d994f05a1255396f64>,
> but I have another post on that topic elsewhere (in doctrine forum).
>

This was replied there. I basically suggest using a simple identifier
instead of such a complex composite key, and if not possible, use the
`@JoinColumns` explicitly.


>
> My goal basically is have an application that uses BjyAuthorize and loads
> Rules from the Database via Doctrine.  Can a good soul take a peek at my
> code perhaps and help me untangle myself?
>

Providers are exactly that. To BjyAuthorize, each provider is basically
just like an array. If you implement the provider for Rule, or Resource or
Role or Identity, then you can register it with BjyAuthorize and the module
will pull information out of it.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/BjyAuthorize-RuleProvider-from-Doctrine-help-requested-tp4661439p4661448.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] Zend\Di\Di configuration array?

2014-01-12 Thread Marco Pivetta
If you want, you can pick up my documentation work from
https://github.com/zendframework/zf2-documentation/pull/82, which is
unfinished. You can also look into
https://github.com/ralphschindler/Zend_DI-Examples

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 10 January 2014 23:14, Philip G  wrote:

> On Fri, Jan 10, 2014 at 12:41 PM, Matthew Weier O'Phinney
> wrote:
>
> > The ServiceManager is far easier to configure, and much more
> > performant (though, as with just about any generalized component,
> > could be even better).
> >
> > If you are looking for an IoC container to manage DI for your various
> > services/instances, I'd recommend Zend\ServiceManager instead of
> > Zend\Di.
> >
>
> I was looking into that, but ran into a configuration snafu when I hit the
> DB component: I couldn't figure out a way to Lazy load PDO (requires a DSN)
> when the DSN is stored within the same file as the SM configuration. And SM
> Configuration doesn't have a built-in "config" pass. All that stuff is
> injected via Zend MVC, which I'm not using. DI doesn't really solve this
> either, but using a Proxy class could work ... maybe.
>
> My application is very simple: a single php tracking script. Reads in
> visits, deciphers their cookies, and makes a call to a DB or Web Service
> back end depending on parameters from their cookie.
>
> The basic requirements are:
>  - Speed
>  - Parsing and managing incoming and outgoing cookies.
>  - Ability to set content-type headers to either json or gif.
>  - Log to directly to DB or Web Services (or neither), depending on cookie
> parameters.
>
> zend-http resolves a number of these: it gives me PhpEnv.\Request and
> Response, as well as Http\Client for WS. My plan for DB was PDO directly
> (using pdo_cassandra).
>
> Now, I want this to be easily swappable for testability, and that's where I
> ran into the trouble. Naturally, you'd think DI and a DiC; however, DiC is
> notorious for not being speedy, unless configured (thus my config
> question). In addition, it's not a lazy loader, something I was toying with
> the idea of Proxy class for.
>
> ServiceManager would resolve the swapability of RequestInterface and
> ResponseInterface. But, I fell when it came to configuring for lazy
> loading. PDO requires a DSN, which is stored within the same config as SM
> values. And, I can't load PDO until I know "this request" is to be logged
> to the DB. WS is slightly less tricky: it's not as overhead dependent, and
> can be instantiated with no impact, and URL set at a later time.
>
> ---
> Philip
> g...@gpcentre.net
> http://www.gpcentre.net/
>


  1   2   3   4   5   >