Issues

ZF-11512: Zend_Tool_Project_Provider_Layout not properly detecting existing layout configuration

Issue Type: Bug Created: 2011-06-29T05:22:13.000+0000 Last Updated: 2011-06-29T20:23:32.000+0000 Status: Resolved Fix version(s): - 1.11.8 (07/Jul/11)

Reporter: Rod Pattison (rodp82) Assignee: Kim Blomqvist (kblomqvist) Tags: - Zend_Tool

Related issues: Attachments: - ZF-11512.patch

Description

When enabling layout using "zf enable layout" on a project that has already has been enabled doesn't get picked up. This is due to a typo in the if-statement. Nothing drastic happens except another " resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" " is added to the application.ini file Also, the .zfproject.xml file isn't updated correctly

Comments

Posted by Rod Pattison (rodp82) on 2011-06-29T05:30:39.000+0000

Apologies for pasting in the patch here, not sure how to attach it

Index: Layout.php

--- Layout.php (revision 24161) +++ Layout.php (working copy) @@ -70,7 +70,7 @@

     $zc = $applicationConfigResource->getAsZendConfig();
  • if (isset($zc->resources) && isset($zf->resources->layout)) {
  • if (isset($zc->resources) && isset($zc->resources->layout)) { $this->_registry->getResponse()->appendContent('A layout resource already exists in this project's application configuration file.'); return; }

@@ -93,6 +93,8 @@ );

     $this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.');
  • $this->_storeProfile(); }

Posted by Kim Blomqvist (kblomqvist) on 2011-06-29T11:30:38.000+0000

Hi Rob,

Thanks for the patch to contribute to ZF. However, before contributing code you should sign the cla (http://framework.zend.com/wiki/display/…). After then you can attach files.

Posted by Kim Blomqvist (kblomqvist) on 2011-06-29T17:33:12.000+0000

Patch attached. Also implements zf disable layout.

Posted by Kim Blomqvist (kblomqvist) on 2011-06-29T20:12:36.000+0000

Disable layout feature removed from the patch.

Posted by Adam Lundrigan (adamlundrigan) on 2011-06-29T20:17:01.000+0000

Reproduce (stdout trimmed for brevity):

<pre class="highlight">
[adam@zfdev tmp] zf create project ZF-11512
[adam@zfdev tmp] cd ZF-11512
[adam@zfdev ZF-11512] zf enable layout
[adam@zfdev ZF-11512] zf enable layout

Result: application/configs/application.ini now contains two resources.layout.layoutPath lines under the production group:

<pre class="highlight">
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

Rob's suggested fix:

<pre class="highlight">

Index: library/Zend/Tool/Project/Provider/Layout.php
===================================================================
--- library/Zend/Tool/Project/Provider/Layout.php       (revision 24163)
+++ library/Zend/Tool/Project/Provider/Layout.php       (working copy)
@@ -70,7 +70,7 @@

         $zc = $applicationConfigResource->getAsZendConfig();

-        if (isset($zc->resources) && isset($zf->resources->layout)) {
+        if (isset($zc->resources) && isset($zc->resources->layout)) {
             $this->_registry->getResponse()->appendContent('A layout resource already exists in this project\'s application configuration file.');
             return;
         }
@@ -95,8 +95,7 @@
             $this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.');
         }

-
-
+        $this->_storeProfile();
     }

     public function disable()

After applying patch, running reproduce sequence from above now shows desired result: (most stdout trimmed for brevity):

<pre class="highlight">
[adam@zfdev tmp] zf create project ZF-11512
[adam@zfdev tmp] cd ZF-11512
[adam@zfdev ZF-11512] zf enable layout
[adam@zfdev ZF-11512] zf enable layout
A layout resource already exists in this project's application configuration file.

Posted by Adam Lundrigan (adamlundrigan) on 2011-06-29T20:21:38.000+0000

Fixed in trunk r24164 Merged to release-1.11 in r24165

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts