Re: [fw-general] Zend_Application_Bootstrap_Bootstrap and Zend_Log
Op Monday 08 June 2009 00:13:41 schreef Ehask71: In the past I usually did this: public static function setupDatabase() { $config = self::$registry-configuration; $db = Zend_Db::factory($config-db-adapter, $config-db-toArray()); $db-query(SET NAMES 'utf8'); self::$registry-database = $db; Zend_Db_Table::setDefaultAdapter($db); // Logger $columnMapping = array('lvl' = 'priority', 'msg' = 'message'); $writer = new Zend_Log_Writer_Db($db, 'log', $columnMapping); $logger = new Zend_Log($writer); self::$registry-logger = $logger; } I setup my Webhosting server to allow Zend_Tool and such. Now I have the Zend_application Bootstrap class. So how do I add an application wide logger like above Thx for any help Eric You could create a Db resource which will initiate your database and set the adapter to the default one. You also create a log resource, which first bootstraps the db resource. Then you're sure the db is setup correctly. The $db var is the same as Zend_Db_Table::getDefaultAdapter() :) Regards, Jurian -- Jurian Sluiman Soflomo.com
[fw-general] CRUD and modularity
I thought to use modular design and make some simple modules guestbook admin area comment area feedback polls news content managment But all these requires almost same CRUD functionality, forms are different database tables and presentation code. But mostly the code keeps to be same in controller part. Currently i am thinking to write this code manually so i wanted to ask for ideas for different approach. -- View this message in context: http://www.nabble.com/CRUD-and-modularity-tp23920809p23920809.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Controller flow changes when using render() inside controller action
Indeed, the plugin postDispatch() is invoked after the helper postDispatch (the ViewRenderer is a helper) where the rendering happens. If you need stuff to happen after the action but before rendering, it must be in a controller postDispatch or a helper postDispatch with a higher priority than ViewRenderer. Thankfully, the ViewRenderer has a very low priority so just add the helper through the HelperBroker and you can be sure it would be invoked before the ViewRenderer. Zend_Controller_Action_HelperBroker::addHelper(new My_Helper()); class My_Helper extends Zend_Controller_Action_Helper_Abstract { public function postDispatch() { /* pre-render logic here */ } } -- Mon On Mon, Jun 8, 2009 at 4:42 PM, agatone zoran.z...@gmail.com wrote: I think I got happy to fast :) If i use setRender() in action, postDispatch() of the controller is called before the script rendereing - that's ok. But Controller Plugin's postDispatch is still called after the render ? should this be called before the render also? Thing is that i tried it calling it inside agatone wrote: Great, it is working. Thank you! Mon Zafra wrote: You probably want $this-_helper-viewRenderer-setRender($action), but only the one in the postDispatch() will take effect since it is always executed after the action. -- Mon On Mon, Jun 8, 2009 at 6:12 AM, agatone zoran.z...@gmail.com wrote: -- View this message in context: http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23920339.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Controller flow changes when using render() inside controller action
What i mean in all this is : If i don't change what script to render and leave it to find script to render byitself the flow is that every postDispatch() (controllers and plugins) is called before the render of view sscript. As soon as i try to render myown script postDispatch() is called after render of the view. In all this i am looking something that I can use just to tell what should be rendered and not to alter the flow - keep it same as if i wouldnt change the view script. All this solutions adding new stuff on it is way to much work for something simple :| Mon Zafra wrote: Indeed, the plugin postDispatch() is invoked after the helper postDispatch (the ViewRenderer is a helper) where the rendering happens. If you need stuff to happen after the action but before rendering, it must be in a controller postDispatch or a helper postDispatch with a higher priority than ViewRenderer. Thankfully, the ViewRenderer has a very low priority so just add the helper through the HelperBroker and you can be sure it would be invoked before the ViewRenderer. Zend_Controller_Action_HelperBroker::addHelper(new My_Helper()); class My_Helper extends Zend_Controller_Action_Helper_Abstract { public function postDispatch() { /* pre-render logic here */ } } -- Mon On Mon, Jun 8, 2009 at 4:42 PM, agatone zoran.z...@gmail.com wrote: -- View this message in context: http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23921673.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] CRUD and modularity
On Monday 08 June 2009 11:37:29 staar2 wrote: I thought to use modular design and make some simple modules guestbook admin area comment area feedback polls news content managment But all these requires almost same CRUD functionality, forms are different database tables and presentation code. But mostly the code keeps to be same in controller part. Currently i am thinking to write this code manually so i wanted to ask for ideas for different approach. This is the place ZF could do with some improvement, scaffolding. Basically, you describe your model with some configuration convention and that should be enough for a BREAD/CRUDL cycle. I've seen some attempts to solve this, but most were pretty limited. A great leap forward would be a Zend_Grid component needed for browsing (I'm writing one second time around, should really make a proposal) and providers for Zend_Tool which would configure Zend_Grid, Zend_Form, generate Zend_Db_Table_Abstract instances and such. As Zend_Form accepts Zend_Config (as should Zend_Grid), this could quite easily become reality. Maybe we could even use some existing GUI modeling tool's output for this. -- Dado
[fw-general] Zend_CodeGenerator_Php_Property Array
Hi all, I recently try to use Zend_CodeGenerator to generate all my DbTables automatically. All it's OK except for one thing! I have multiple key for a primary key and I can't define a Zend_CodeGenerator_Php_Property which is an array?! What I want: protected $_myProperty = array('val1', 'val2'); What I have: protected $_myProperty = 'array('val1', 'val2')'; There is a solution ? Thanks
Re: [fw-general] CRUD and modularity
-- Dalibor Karlović d...@krizevci.info wrote (on Monday, 08 June 2009, 12:49 PM +0200): On Monday 08 June 2009 11:37:29 staar2 wrote: I thought to use modular design and make some simple modules guestbook admin area comment area feedback polls news content managment But all these requires almost same CRUD functionality, forms are different database tables and presentation code. But mostly the code keeps to be same in controller part. Currently i am thinking to write this code manually so i wanted to ask for ideas for different approach. This is the place ZF could do with some improvement, scaffolding. Basically, you describe your model with some configuration convention and that should be enough for a BREAD/CRUDL cycle. I've seen some attempts to solve this, but most were pretty limited. Ralph is actually working on some additions to Zend_Tool_Project for exactly this functionality. :) A great leap forward would be a Zend_Grid component needed for browsing (I'm writing one second time around, should really make a proposal) Personally, I'm not entirely sure this is necessary with components like Zend_Paginator and Dojo's dojox.DataGrid component. I've done a ton with those and the code is incredibly simple. and providers for Zend_Tool which would configure Zend_Grid, Zend_Form, generate Zend_Db_Table_Abstract instances and such. As Zend_Form accepts Zend_Config (as should Zend_Grid), this could quite easily become reality. Maybe we could even use some existing GUI modeling tool's output for this. I'd *love* to see someone tackle the DB schema = Zend_Form problem sometime -- it's something I envisioned from the outset when developing Zend_Form, but never had a chance to work on. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/
[fw-general] Test-driven development does not work properly with Zend_Test
Hi, I have a problem that makes TDD with Zend_Test impossible and I don't know with which release this problem was introduced and how to solve it. Think of a test case like this: -- class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase { public function testShowArticle() { $this-dispatch('/index/show/id/2'); $this-assertController('index'); $this-assertAction('show'); $this-assertEquals('2', $this-request-getParam('id')); $this-assertRoute('default'); } } -- And now lets presume that the IndexController exists but the showAction() is not available yet due to the TDD approach. When I run PHPUnit for this test case I only get this error: -- 1) testShowArticle(IndexControllerTest) Failed asserting last controller used was index /home/devhost/phpmagazin/tdd3/library/Zend/Test/PHPUnit/ControllerTestCase.php:931 /home/devhost/phpmagazin/tdd3/tests/controllers/IndexControllerTest.php:41 -- I would expect that the line with the dispatch() call throws an error telling me that the showAction() method does not exist in IndexController class. But it doesn't. With a little investigation I found out that the ErrorHandler handles this error and moves the action to ErrorController::errorAction(). What am I doing wrong? Should I deactivate the ErrorHandler for all test cases? Or is there a better approach? Thanks and best regards, Ralf
Re: [fw-general] Test-driven development does not work properly with Zend_Test
2009/6/8 Ralf Eggert r.egg...@travello.de [testing non-existent actions] And now lets presume that the IndexController exists but the showAction() is not available yet due to the TDD approach. When I run PHPUnit for this test case I only get this error: -- 1) testShowArticle(IndexControllerTest) Failed asserting last controller used was index /home/devhost/phpmagazin/tdd3/library/Zend/Test/PHPUnit/ControllerTestCase.php:931 /home/devhost/phpmagazin/tdd3/tests/controllers/IndexControllerTest.php:41 -- I would expect that the line with the dispatch() call throws an error telling me that the showAction() method does not exist in IndexController class. But it doesn't. With a little investigation I found out that the ErrorHandler handles this error and moves the action to ErrorController::errorAction(). I think setting throwExceptions to true on your front controller in test mode only should fix this, but you won't then be able test some of the error controller functionality. -- Tim Fountain http://tfountain.co.uk/
Re: [fw-general] CRUD and modularity
On Monday 08 June 2009 13:52:53 Matthew Weier O'Phinney wrote: -- Dalibor Karlović d...@krizevci.info wrote (on Monday, 08 June 2009, 12:49 PM +0200): On Monday 08 June 2009 11:37:29 staar2 wrote: I thought to use modular design and make some simple modules guestbook admin area comment area feedback polls news content managment But all these requires almost same CRUD functionality, forms are different database tables and presentation code. But mostly the code keeps to be same in controller part. Currently i am thinking to write this code manually so i wanted to ask for ideas for different approach. This is the place ZF could do with some improvement, scaffolding. Basically, you describe your model with some configuration convention and that should be enough for a BREAD/CRUDL cycle. I've seen some attempts to solve this, but most were pretty limited. Ralph is actually working on some additions to Zend_Tool_Project for exactly this functionality. :) This is great news, anything to see/test yet? IMHO, Zend_Tool is a major point of interest for ZF, hats of to Ralph. A great leap forward would be a Zend_Grid component needed for browsing (I'm writing one second time around, should really make a proposal) Personally, I'm not entirely sure this is necessary with components like Zend_Paginator and Dojo's dojox.DataGrid component. I've done a ton with those and the code is incredibly simple. Yeah, I've seen that argument pulled a couple of times. :) The truth is many people can't depend on Dojo (jQuery shop here, for example). A well though out grid component could be to dojox.DataGrid what Zend_Form is to ZendX_JQuery_Form. I have some ideas by which I've come mostly by trial test (as I said, I'm in the middle of my second try) so I'd love to hear some input on it, probably on the core ML? and providers for Zend_Tool which would configure Zend_Grid, Zend_Form, generate Zend_Db_Table_Abstract instances and such. As Zend_Form accepts Zend_Config (as should Zend_Grid), this could quite easily become reality. Maybe we could even use some existing GUI modeling tool's output for this. I'd *love* to see someone tackle the DB schema = Zend_Form problem sometime -- it's something I envisioned from the outset when developing Zend_Form, but never had a chance to work on. The problem is the same as is with regular models, if you have a 1:1 relationship with the table, you're good, but things start to complicate real fast. :) What I love as an idea is to write some XML/INI/yaml/whatever and you're basically done: the framework generates your schema (Doctrine, anybody?) and completes your CRUDL cycle. Do this a couple of times and you get a working backend/admin/whatever. As your models already returns some data, you can start working on the frontend in an instant. Now, that's putting R in RAD. :) -- Dado
Re: [fw-general] Zend_CodeGenerator_Php_Property Array
i also wanted to do something similar ... to generate models from MySQL infomation_schema http://www.nabble.com/Zend_CodeGenerator-arrays-as-property-to23694912.html#a23719003 http://www.nabble.com/Zend_CodeGenerator-arrays-as-property-to23694912.html#a23719003 the workaround posted there CocoRambo wrote: Hi all, I recently try to use Zend_CodeGenerator to generate all my DbTables automatically. All it's OK except for one thing! I have multiple key for a primary key and I can't define a Zend_CodeGenerator_Php_Property which is an array?! What I want: protected $_myProperty = array('val1', 'val2'); What I have: protected $_myProperty = 'array('val1', 'val2')'; There is a solution ? Thanks -- View this message in context: http://www.nabble.com/Zend_CodeGenerator_Php_Property---Array-tp23922419p23923769.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Paginator and Zend_Paginator_Adapter_Null
Hi. I noticed that there is some problem with this adapter. Code: $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null(46)); $paginator-setCurrentPageNumber($page); $paginator-setItemCountPerPage(10); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); So, I have 46 items. The problem is, when I'm on the last page, it says : 'Displaying 10 of 46' instead 'Displaying 6 of 46'. Because [lastItemNumber] = int(50) and [currentItemCount] = int(10), so, this is some bug probably. Anyone with same problem? Regards, Sasa Stamenkovic. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23923917.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Test-driven development does not work properly with Zend_Test
Hi Tim, I think setting throwExceptions to true on your front controller in test mode only should fix this, but you won't then be able test some of the error controller functionality. That did not help at all. I turned of the ErrorHandler and that worked partly. Now I don't get any error at all, i.e. the test passes although the IndexController::showAction() method does not exist yet. This is annoying since I worked Test-driven for ages with ZF and now after moving to 1.8.2 my approach is not possible any more. Any one any ideas? Thanks, Ralf P.S. Maybe the upgrade to a new PHPUnit version caused this issue?
Re: [fw-general] Zend_Application_Bootstrap_Bootstrap and Zend_Log
Thx! But now I get errors No Registry Entry for logger I guess its back to the Docs to figure out how setting Registry stuff was changed. Man this can kill dev time especially when you quote x Hours on a project then ZF jacks everything up from the way you thought it or used to work. There are no good examples out to show what a new Bootstrap should look like compared to an old one with Modules,Logger, etc. The Reference and Wiki always leave me scratching my head LOL Im glad I did this on a small project of my own. I will continue to use my old Bootstrap.php on paying jobs till I figure this out. Spent all weekend trying to get my head around the new bootstrap and still have a lost feeling Thx for the help Jurian Eric Jurian Sluiman wrote: You could create a Db resource which will initiate your database and set the adapter to the default one. You also create a log resource, which first bootstraps the db resource. Then you're sure the db is setup correctly. The $db var is the same as Zend_Db_Table::getDefaultAdapter() :) Regards, Jurian -- Jurian Sluiman Soflomo.com -- View this message in context: http://www.nabble.com/Zend_Application_Bootstrap_Bootstrap--and-Zend_Log-tp23915940p23924678.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Application_Bootstrap_Bootstrap and Zend_Log
Op Monday 08 June 2009 16:03:45 schreef Ehask71: Thx! But now I get errors No Registry Entry for logger I guess its back to the Docs to figure out how setting Registry stuff was changed. Man this can kill dev time especially when you quote x Hours on a project then ZF jacks everything up from the way you thought it or used to work. There are no good examples out to show what a new Bootstrap should look like compared to an old one with Modules,Logger, etc. The Reference and Wiki always leave me scratching my head LOL Im glad I did this on a small project of my own. I will continue to use my old Bootstrap.php on paying jobs till I figure this out. Spent all weekend trying to get my head around the new bootstrap and still have a lost feeling Thx for the help Jurian Eric Jurian Sluiman wrote: You could create a Db resource which will initiate your database and set the adapter to the default one. You also create a log resource, which first bootstraps the db resource. Then you're sure the db is setup correctly. The $db var is the same as Zend_Db_Table::getDefaultAdapter() :) Regards, Jurian Just pay some attention to the Zend_Registry page of the manual: http://framework.zend.com/manual/en/zend.registry.html. The class has some static methods which might become very useful ;) -- Jurian Sluiman Soflomo.com
Re: [fw-general] Controller flow changes when using render() inside controller action
That's not true. The plugin postDispatch always occurs after the rendering. It doesn't matter if you manually render in the controller or let the ViewRenderer render. The plugin postDispatch will still be called afterward. You are also not altering the application flow by changing the action script in the ViewRenderer. You're simply changing the value of an instance member. And I believe that's exactly what you want. I'm not sure what led you to believe that the flow is altered, but perhaps you could share with us some code so we could see what's happening. -- Mon On Mon, Jun 8, 2009 at 6:32 PM, agatone zoran.z...@gmail.com wrote: What i mean in all this is : If i don't change what script to render and leave it to find script to render byitself the flow is that every postDispatch() (controllers and plugins) is called before the render of view sscript. As soon as i try to render myown script postDispatch() is called after render of the view. In all this i am looking something that I can use just to tell what should be rendered and not to alter the flow - keep it same as if i wouldnt change the view script. All this solutions adding new stuff on it is way to much work for something simple :| Mon Zafra wrote: Indeed, the plugin postDispatch() is invoked after the helper postDispatch (the ViewRenderer is a helper) where the rendering happens. If you need stuff to happen after the action but before rendering, it must be in a controller postDispatch or a helper postDispatch with a higher priority than ViewRenderer. Thankfully, the ViewRenderer has a very low priority so just add the helper through the HelperBroker and you can be sure it would be invoked before the ViewRenderer. Zend_Controller_Action_HelperBroker::addHelper(new My_Helper()); class My_Helper extends Zend_Controller_Action_Helper_Abstract { public function postDispatch() { /* pre-render logic here */ } } -- Mon On Mon, Jun 8, 2009 at 4:42 PM, agatone zoran.z...@gmail.com wrote: -- View this message in context: http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23921673.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Paginator and Zend_Paginator_Adapter_Null
Yes, there's a ticket for it. -Matt On Mon, Jun 8, 2009 at 6:17 AM, umpirsky umpir...@gmail.com wrote: Hi. I noticed that there is some problem with this adapter. Code: $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null(46)); $paginator-setCurrentPageNumber($page); $paginator-setItemCountPerPage(10); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); So, I have 46 items. The problem is, when I'm on the last page, it says : 'Displaying 10 of 46' instead 'Displaying 6 of 46'. Because [lastItemNumber] = int(50) and [currentItemCount] = int(10), so, this is some bug probably. Anyone with same problem? Regards, Sasa Stamenkovic. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23923917.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Application_Bootstrap_Bootstrap and Zend_Log
-- Ehask71 cybertuff...@verizon.net wrote (on Monday, 08 June 2009, 07:03 AM -0700): Thx! But now I get errors No Registry Entry for logger I guess its back to the Docs to figure out how setting Registry stuff was changed. The bootstrap uses what is considered a local registry, versus a global static registry. As a result, you cannot use Zend_Registry's get, set, or isRegistered methods in order to locate items, as these operate on the global, static registry. As a convenience, the bootstrap exposes a getResource() method which can be used to pull resources from the local registry by name. The bootstrap gets registered with the front controller as a parameter, so you can always fetch a resource by pulling the bootstrap from the front controller. For example, to get your logger resource, try the following: $bootstrap = Zend_Controller_Front::getInstance()-getParam('bootstrap'); $logger= $bootstrap-getResource('logger'); // or, using method chaining: $logger = Zend_Controller_Front::getInstance() -getParam('bootstrap') -getResource('logger'); Within your action controllers, front controller parameters may be pulled using the getInvokeArg() method; you can use this to get your bootstrap... and then your resource: $bootstrap = $this-getInvokeArg('bootstrap'); $logger= $bootstrap-getResource('logger'); // or, using method chaining: $logger = $this-getInvokeArg('bootstrap') -getResource('logger'); This is documented in the manual; see section 4.3.1.3, Resource Registry, here: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html#zend.application.theory-of-operation.bootstrap.registry Man this can kill dev time especially when you quote x Hours on a project then ZF jacks everything up from the way you thought it or used to work. We've been trying hard to build out functionality incrementally. The addition of Zend_Application codifies some paradigms and best practices we've been working on, but it's clear that migration has been a bit difficult for some. If you have any thoughts on how to mitigate this in the future, I'd love to hear them! There are no good examples out to show what a new Bootstrap should look like compared to an old one with Modules,Logger, etc. The Reference and Wiki always leave me scratching my head LOL Well, we didn't actually have a formal bootstrap class previously, so I'm not entirely sure what you're referring to. Previously, bootstrapping was entirely procedural. Jurian Sluiman wrote: You could create a Db resource which will initiate your database and set the adapter to the default one. You also create a log resource, which first bootstraps the db resource. Then you're sure the db is setup correctly. The $db var is the same as Zend_Db_Table::getDefaultAdapter() :) -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/
[fw-general] Problem with 1.8.2 and ZendServer(5.3RC)
Hello, I'm testing Zenderver 5.3RC at this point. My existing application runs just fine, exept when I try to write data to a db. I'm using ZendDB and on an update or insert call I get this error: Mysqli statement execute error : No data supplied for parameters in prepared statement Somebody with an idea on this? Thanks and greetings, Stefan Sturm
Re: [fw-general] New at this -- Can the ZF be used in front of 3rd party applications?
Hello Matthew, On Mon, Jun 8, 2009 at 4:50 AM, Matthew Weier O'Phinneymatt...@zend.com wrote: I've done this sort of thing with a few apps (using them inside ZF in order to benefit from things like shared layouts), and it's typically been a huge pain. I've blogged about it: http://weierophinney.net/matthew/archives/138-Start-Writing-Embeddable-Applications.html ... Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ Thanks a bunch for the info. Kind of unfortunate to hear but it clearly looks like other folks have the same issue. Out of interest I searched on the embed concept for one application, DocuWiki again, and got to this - http://forum.dokuwiki.org/thread/1496 I'm sure that all makes sense, but it's not 'plain english' to me whether it can work. I guess the more important question I need to think about is whether the ZF is a 'solution' for me at all given the state of affairs you blog about. Bob
Re: [fw-general] Zend_Application_Bootstrap_Bootstrap and Zend_Log
Matthew, I understand why things are being done and as a Software guy understand when a major release comes out the issues invloved. At age 37 I guess sometimes it gets disheartening when you cant make something work :) and you were able to make it work before. Please don't read into what I said as a bash against ZF just me dealing with my Frustration. As I had just setup my Web Hosting servers to allow Zend_Tool. I want to make sure I understand it before customers start calling me :) Thx guys I have some reading to do Eric Matthew Weier O'Phinney-3 wrote: -- Ehask71 cybertuff...@verizon.net wrote (on Monday, 08 June 2009, 07:03 AM -0700): Thx! But now I get errors No Registry Entry for logger I guess its back to the Docs to figure out how setting Registry stuff was changed. The bootstrap uses what is considered a local registry, versus a global static registry. As a result, you cannot use Zend_Registry's get, set, or isRegistered methods in order to locate items, as these operate on the global, static registry. As a convenience, the bootstrap exposes a getResource() method which can be used to pull resources from the local registry by name. The bootstrap gets registered with the front controller as a parameter, so you can always fetch a resource by pulling the bootstrap from the front controller. For example, to get your logger resource, try the following: $bootstrap = Zend_Controller_Front::getInstance()-getParam('bootstrap'); $logger= $bootstrap-getResource('logger'); // or, using method chaining: $logger = Zend_Controller_Front::getInstance() -getParam('bootstrap') -getResource('logger'); Within your action controllers, front controller parameters may be pulled using the getInvokeArg() method; you can use this to get your bootstrap... and then your resource: $bootstrap = $this-getInvokeArg('bootstrap'); $logger= $bootstrap-getResource('logger'); // or, using method chaining: $logger = $this-getInvokeArg('bootstrap') -getResource('logger'); This is documented in the manual; see section 4.3.1.3, Resource Registry, here: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html#zend.application.theory-of-operation.bootstrap.registry Man this can kill dev time especially when you quote x Hours on a project then ZF jacks everything up from the way you thought it or used to work. We've been trying hard to build out functionality incrementally. The addition of Zend_Application codifies some paradigms and best practices we've been working on, but it's clear that migration has been a bit difficult for some. If you have any thoughts on how to mitigate this in the future, I'd love to hear them! There are no good examples out to show what a new Bootstrap should look like compared to an old one with Modules,Logger, etc. The Reference and Wiki always leave me scratching my head LOL Well, we didn't actually have a formal bootstrap class previously, so I'm not entirely sure what you're referring to. Previously, bootstrapping was entirely procedural. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Zend_Application_Bootstrap_Bootstrap--and-Zend_Log-tp23915940p23927214.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Paginator and Zend_Paginator_Adapter_Null
Thanks for the quick response. Can you provide url to this issue, please? I'm curious when it will be fixed. Matthew Ratzloff wrote: Yes, there's a ticket for it. -Matt On Mon, Jun 8, 2009 at 6:17 AM, umpirsky umpir...@gmail.com wrote: Regards, Sasa Stamenkovic. Hi. I noticed that there is some problem with this adapter. Code: $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null(46)); $paginator-setCurrentPageNumber($page); $paginator-setItemCountPerPage(10); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); So, I have 46 items. The problem is, when I'm on the last page, it says : 'Displaying 10 of 46' instead 'Displaying 6 of 46'. Because [lastItemNumber] = int(50) and [currentItemCount] = int(10), so, this is some bug probably. Anyone with same problem? Regards, Sasa Stamenkovic. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23923917.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23927501.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Problem with 1.8.2 and ZendServer(5.3RC)
I encountered it as well. A quick fix would be to switch to PDO Mysqli adapter which should be transparent in most cases. This might buy you some time until PHP 5.3 is stable and the issue is resolved. Karol Stefan Sturm-2 wrote: Hello, I'm testing Zenderver 5.3RC at this point. My existing application runs just fine, exept when I try to write data to a db. I'm using ZendDB and on an update or insert call I get this error: Mysqli statement execute error : No data supplied for parameters in prepared statement Somebody with an idea on this? Thanks and greetings, Stefan Sturm -- View this message in context: http://www.nabble.com/Problem-with-1.8.2-and-ZendServer%285.3RC%29-tp23926702p23928903.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Controller flow changes when using render() inside controller action
Sorry, yes you are right. PostDispatch of plugin always occours after the rendering of the view. I'll try the solution with adding helper, thank you. I hoped i can solve it directily in the plugin. thanks Mon Zafra wrote: That's not true. The plugin postDispatch always occurs after the rendering. It doesn't matter if you manually render in the controller or let the ViewRenderer render. The plugin postDispatch will still be called afterward. You are also not altering the application flow by changing the action script in the ViewRenderer. You're simply changing the value of an instance member. And I believe that's exactly what you want. I'm not sure what led you to believe that the flow is altered, but perhaps you could share with us some code so we could see what's happening. -- Mon -- View this message in context: http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23929707.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Test-driven development does not work properly with Zend_Test
do you use phpunit 3.4? this might be a problem indeed. otherwise, zend_test is doing integration testing and using that soley for test-driven-development is probably a bad idea, since you test too many components in conjunction rather than unit-testing a single component in isolation. greetings, Benjamin On Monday 08 June 2009 03:18:26 pm Ralf Eggert wrote: Hi Tim, I think setting throwExceptions to true on your front controller in test mode only should fix this, but you won't then be able test some of the error controller functionality. That did not help at all. I turned of the ErrorHandler and that worked partly. Now I don't get any error at all, i.e. the test passes although the IndexController::showAction() method does not exist yet. This is annoying since I worked Test-driven for ages with ZF and now after moving to 1.8.2 my approach is not possible any more. Any one any ideas? Thanks, Ralf P.S. Maybe the upgrade to a new PHPUnit version caused this issue? -- Benjamin Eberlei http://www.beberlei.de
Re: [fw-general] Zend_Paginator and Zend_Paginator_Adapter_Null
http://framework.zend.com/issues/browse/ZF-3873 It was fixed at one point, but it appears there was a regression. -Matt On Mon, Jun 8, 2009 at 9:30 AM, umpirsky umpir...@gmail.com wrote: Thanks for the quick response. Can you provide url to this issue, please? I'm curious when it will be fixed. Matthew Ratzloff wrote: Yes, there's a ticket for it. -Matt On Mon, Jun 8, 2009 at 6:17 AM, umpirsky umpir...@gmail.com wrote: Regards, Sasa Stamenkovic. Hi. I noticed that there is some problem with this adapter. Code: $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null(46)); $paginator-setCurrentPageNumber($page); $paginator-setItemCountPerPage(10); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); So, I have 46 items. The problem is, when I'm on the last page, it says : 'Displaying 10 of 46' instead 'Displaying 6 of 46'. Because [lastItemNumber] = int(50) and [currentItemCount] = int(10), so, this is some bug probably. Anyone with same problem? Regards, Sasa Stamenkovic. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23923917.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Zend_Paginator-and-Zend_Paginator_Adapter_Null-tp23923917p23927501.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] General - Web Development Frameworks
i am using Zend Framework now, but hear that Ruby on Rails is great, speeds up development and all. ASP.NET MVC is also out. i am looking at these alternatives to see what they offer but will like some of ur opinions what might be some of the advantages/disadvantages of each? like in terms of - speed of development - speed (performance) of execution - cost - etc for a start: Zend Framework my background with this is ~3 mths Good: * Templating thru Zend_Layouts Zend_Views * Zend_Forms, Zend_Validation, Zend_Filter: assists in form inputs * Zend_Tool now allows for something like Ruby on Rails's CMD code genration except that its now still very limited in terms of functionality Bad: * steep learning curve * can be confusing for me now still Ruby on Rails viewed some screencasts only Good * i like the cmd code generation for controller, actions, models and forms * it seems to be easily incorporated with AJAX Bad * i get the impression that it will be hard to deploy ASP.NET MVC also watched a few screencasts only Good * i like LINQ * extensive support with VS 2010 will speed up development Bad * expensive -- View this message in context: http://www.nabble.com/General---Web-Development-Frameworks-tp23936439p23936439.html Sent from the Zend Framework mailing list archive at Nabble.com.