Re: [fw-general] Module name not available in bootstrap file
I'm not sure if this is what you were aiming to do, but this sounded like a similar problem I was tackling. I wanted to know what module was going to be used before I dispatched as there would be varying requirements for each. In my case it is the difference between an admin section and a client section. Using this code let me see what the current module is. //Create a router and request object $router = new Zend_Controller_Router_Rewrite(); $request = new Zend_Controller_Request_Http(); $router-route($request); echo $request-getModuleName(); I hope this helps you out -Jude A. On Fri, 16 Mar 2007 13:20:17 +0900, david pr [EMAIL PROTECTED] wrote: Hi, I am trying to use modules. It is half successful - my controllers are being found in the appropriate directory - my problem is I want to set the view script path to the appropriate module but the module name is only available after the front controller is dispatched. I can see in /Zend/Controller/Front.php that the module is set when the following code is executed in function dispatch():- $router-route($request); But I can't see how I can set up the router before dispatching. I don't want to set up my view's script path in every controller. I would like to do it in the bootstrap file. I can't see how I can easily do this. Find below a snippet of my bootstrap file. Can someone help please? version 0.8.0 index.php (snippet) $module =$frontController-getRequest()-getModuleName(); /* returns blank */ // initialize view Zend::loadClass($viewClassName); $view = new $viewClassName(); $view-setScriptPath($module/application/views'); Zend::register('view', $view); // run $frontController-dispatch(); $module =$frontController-getRequest()-getModuleName(); /* returns correct module name */
Re: [fw-general] Zend_Db Exception throwing?
Excellent thanks. I've added in a SELECT 1 query inside my try/catch block to grab a connection error now -Jude A. On Mon, 19 Mar 2007 17:11:54 +0900, Alexander Netkachev [EMAIL PROTECTED] wrote: Zend_Db_Adapter does not create a connection to the database when you create it. The real PDO Connection is created when you execute first query or create instance of Zend_Db_Table class. So, the try/catch block does not catch this exception just because it is fired later in the code, when the real connection is created. Sincerely,
Re: [fw-general] unclear example of using of zend registry
Or keep going and just autoload the lot: include 'Zend/Loader.php'; function __autoload( $class ) { Zend_Loader::loadClass( $class ); } Nick Try adding: Zend_Loader::loadClass('Zend_Registry'); in you bootstrap file under the Zend_Loader::loadClass('Zend_View'); Regards, Rob... ZegeeDotCom wrote: WHen I do this in my boot-strapper: Zend_Loader::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend_Registry::set('view',$view); and this in my default index controller: $view = Zend_Registry::get('view'); it gives me an error: Fatal error: Class 'Zend_Registry' not found and I have to reinstantiate the view in the controller to get this to work. This is not right.
Re: [fw-general] unclear example of using of zend registry
Yes. However, spl_autoload_register(array('Zend_Loader', 'autoload')); is cleaner to my eyes at least :) Regards, Rob... Nick Lo wrote: Or keep going and just autoload the lot: include 'Zend/Loader.php'; function __autoload( $class ) { Zend_Loader::loadClass( $class ); } Nick
Re: [fw-general] unclear example of using of zend registry
Ok Rob you win this time but mark my words, I'll be back, I'll be back! ...but erm, I'll take that bit of code with me. Nick Yes. However, spl_autoload_register(array('Zend_Loader', 'autoload')); is cleaner to my eyes at least :) Regards, Rob... Nick Lo wrote: Or keep going and just autoload the lot: include 'Zend/Loader.php'; function __autoload( $class ) { Zend_Loader::loadClass( $class ); } Nick
Re: [fw-general] Newbiew with ZF
Hi, There is a list of tutorials on the wiki : http://framework.zend.com/wiki/display/ZFUSER/External+Resources+-+Tutorials%2C+Articles%2C+and+Examples Cheers, Philippe -- Philippe Le Van mail : [EMAIL PROTECTED] web : http://www.kitpages.fr ReynierPM wrote: Hi every one: I'm newbiew using ZF so I'm asking if exists a tutorial, not a documentation, for a fresh start. I'm looking in a ZF Site but can't find any. I speak Spanish as native language so if any can help me ... Cheers and thanks in advance -- Salu2 ReynierPM | 5to. Ing Informática -- Philippe Le Van tel : 04 7670 9303 / 06 6209 2667 mail : [EMAIL PROTECTED] web : http://www.kitpages.fr
Re: [fw-general] Zend_Filter_Input...
Hi, I don't understand why it was removed. Instead of writing Zend_Loader::loadClass('Zend_Filter_Input'); $input = new Zend_Filter_Input($this-_getAllParams()); $id = $input-getDigits('id'); $name = $input-getAlpha('name'); $login = $input-getAlnum('login'); I have to use Zend_Loader::loadClass('Zend_Filter_Digits'); Zend_Loader::loadClass('Zend_Filter_Alpha'); Zend_Loader::loadClass('Zend_Filter_Alnum'); $id = Zend_Filter_Digits::filter($this-_getParam('id')); $name = Zend_Filter_Alpha::filter($this-_getParam('name')); $login = Zend_Filter_Alnum::filter($this-_getParam('login')); Where is the improvement? We use a central module_Controllers_Action extends Zend_Controller_Action, in its init-function we just called $this-input = new Zend_Filter_Input($this-_getAllParams()); and we had access to the Filter in every Controller. I guess I will just copy the functions of Zend_Filter_Input to a own class :) cya, Alex Jason Qi schrieb: Please to see Rob's Goodbye Zend.php http://akrabat.com/ Hope it helps Jason. */Adam Balgach [EMAIL PROTECTED]/* wrote: All, How does the functionality change from .8 - .9 for Zend_Filter_Input... I was using something like: Zend::register('post', new Zend_Filter_Input($_POST, false)); Zend::register('get', new Zend_Filter_Input($_GET, false)); but i see this class has gone away... TV dinner still cooling? Check out Tonight's Picks http://us.rd.yahoo.com/evt=49979/*http://tv.yahoo.com/ on Yahoo! TV.
Re: [fw-general] Media Temple Grid Server
Fixed!! Rediculous problem!!! my classes did not begin with capital letters and the zend framework was calling them with capitals... So i had to change my classes to begin with capitals. -- View this message in context: http://www.nabble.com/Media-Temple-Grid-Server-tf3423022s16154.html#a9553376 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] bootstrap controller setup...
-- ZegeeDotCom [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 07:57 AM -0700): I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front-throwExceptions(true); does this look good enough? No. run() does all dispatching, so by the time you're calling throwExceptions(), the exceptions have already been thrown and caught. If you *need* to use run(), try: $front = Zend_Controller_Front::getInstance(); $front-throwExceptions(true); Zend_Controller_Front::run('../application/controllers'); -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] bootstrap controller setup...
ZegeeDotCom schreef: Can someone provide a good example for the bootstrap file ??? The changes to the 0.9 versions are not clear.and all my code that worked under 0.8 doesnt do anything, I cant even see any exceptions - zero, nada. Please give a more thorough explanation for how the controller and views are set up in the bootstrap. Thank you! ZegeeDotCom wrote: I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front-throwExceptions(true); does this look good enough? in my previous 0.8 framework, things worked really well... Hi, You probably want to read through: http://andries.systray.be/blog/2007/03/10/zendphp-rewritten/ Best, -- Andries Seutens http://andries.systray.be Gecontroleerd op virussen door de JOJO Secure Gateway.
Re: [fw-general] bootstrap controller setup...
still cant see a thing. I read every piece of documentation and not in a single one there is a good example of what the bootstrap file looks like under new 0.9. This is discouraging, since it worked fine under 0.8 and all docs are for previous versions. I am tempted to just abandon using ZF if there is lack of proper documentation! Matthew Weier O wrote: -- ZegeeDotCom [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 07:57 AM -0700): I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front-throwExceptions(true); does this look good enough? No. run() does all dispatching, so by the time you're calling throwExceptions(), the exceptions have already been thrown and caught. If you *need* to use run(), try: $front = Zend_Controller_Front::getInstance(); $front-throwExceptions(true); Zend_Controller_Front::run('../application/controllers'); -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/ -- View this message in context: http://www.nabble.com/bootstrap-controller-setup...-tf3427552s16154.html#a9554389 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] unclear example of using of zend registry
I did exactly what you say but I was getting a class not found error. [EMAIL PROTECTED] wrote: On 19/03/07, Nick Lo [EMAIL PROTECTED] wrote: Zend_Registry::set('config',$config); Zend_Registry::get('config'); http://framework.zend.com/manual/en/zend.registry.html Zend_Registry::set('config',$config); replaces Zend::register() Zend_Registry::get('config'); replaces Zend::registry() Still, I hope Zend::registry() not removed because it exists in all Actions ^^ while Zend::register() only in bootstrap -- View this message in context: http://www.nabble.com/unclear-example-of-using-of-zend-registry-tf3425165s16154.html#a9554403 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] bootstrap controller setup...
Still nothing...here is the revised bootstrap file: Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::getInstance(); $front-throwExceptions(true); $front = Zend_Controller_Front::run('../application/controllers'); Zend_Loader::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); $front-setParam('view', $view ) still, my views are not generated ZegeeDotCom wrote: I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front-throwExceptions(true); does this look good enough? in my previous 0.8 framework, things worked really well... -- View this message in context: http://www.nabble.com/bootstrap-controller-setup...-tf3427552s16154.html#a9554529 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] bootstrap controller setup...
-- ZegeeDotCom [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 08:30 AM -0700): still cant see a thing. I read every piece of documentation and not in a single one there is a good example of what the bootstrap file looks like under new 0.9. This is discouraging, since it worked fine under 0.8 and all docs are for previous versions. I am tempted to just abandon using ZF if there is lack of proper documentation! I'd rather you help me improve the documentation! As mentioned in previous emails, there have been no real changes to the MVC since 0.8 -- only some additional, optional features (which would not affect what you're seeing, as they are only invoked when called), and one minor under-the-hood change (all content is aggregated into the response object by default using output buffering). The only updated docs will be documentation of new features; the basic operation remains the same. Can you try the following for me? require_once 'Zend/Controller/Front.php'; $front = Zend_Controller_Front::getInstance(); $front-setParam('disableOutputBuffering', true) -throwExceptions(true) -setControllerDirectory('../application/controllers'); $front-dispatch(); and report back what you see? I'm wondering if the output buffering is swallowing the exception message. It shouldn't, but this will let me know. Matthew Weier O wrote: -- ZegeeDotCom [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 07:57 AM -0700): I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front- throwExceptions(true); does this look good enough? No. run() does all dispatching, so by the time you're calling throwExceptions(), the exceptions have already been thrown and caught. If you *need* to use run(), try: $front = Zend_Controller_Front::getInstance(); $front- throwExceptions(true); Zend_Controller_Front::run('../application/controllers'); -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] unclear example of using of zend registry
-- ZegeeDotCom [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 08:33 AM -0700): I did exactly what you say but I was getting a class not found error. Did you load the Zend_Registry class? require_once 'Zend/Registry.php'; // or, if Zend_Loader is already loaded: Zend_Loader::loadClass('Zend_Registry'); [EMAIL PROTECTED] wrote: On 19/03/07, Nick Lo [EMAIL PROTECTED] wrote: Zend_Registry::set('config',$config); Zend_Registry::get('config'); http://framework.zend.com/manual/en/zend.registry.html Zend_Registry::set('config',$config); replaces Zend::register() Zend_Registry::get('config'); replaces Zend::registry() Still, I hope Zend::registry() not removed because it exists in all Actions ^^ while Zend::register() only in bootstrap -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Clear example of full working bootstrap please
ZegeeDotCom schreef: Why do you release new versions without any documentation I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! So I am installing Symfony again, gosh - I hope they had added more docs... Most of us are doing this in our free time, so give it a break will you. Instead of spamming the mailing list with how badly you want to switch to symfony, i rather see you helping out with the documentation! -- Andries Seutens http://andries.systray.be Gecontroleerd op virussen door de JOJO Secure Gateway.
Re: [fw-general] Clear example of full working bootstrap please
I would like to help, but how can I help if I dont know the features of the framework. The basics should be covered. The docs on the framework are spanning 10 different versions and each version differs. It is just a headache - thats all. And if it is a headache to me - others must be frustrated too. Andries Seutens wrote: ZegeeDotCom schreef: Why do you release new versions without any documentation I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! So I am installing Symfony again, gosh - I hope they had added more docs... Most of us are doing this in our free time, so give it a break will you. Instead of spamming the mailing list with how badly you want to switch to symfony, i rather see you helping out with the documentation! -- Andries Seutens http://andries.systray.be Gecontroleerd op virussen door de JOJO Secure Gateway. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9554920 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Clear example of full working bootstrap please
ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change.
Re: [fw-general] Clear example of full working bootstrap please
You might have not noticed that your are using a *preview* versionthis means the API has become stable only with the 0.9 release Anyway if you want us to help you I think you should reply to the questions sent to youin particular Matthew Weier O'Phinney asked you to try some code to test your applicationwe are still waiting for your return... Le lundi 19 mars 2007, ZegeeDotCom a écrit : I would like to help, but how can I help if I dont know the features of the framework. The basics should be covered. The docs on the framework are spanning 10 different versions and each version differs. It is just a headache - thats all. And if it is a headache to me - others must be frustrated too. Andries Seutens wrote: ZegeeDotCom schreef: Why do you release new versions without any documentation I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! So I am installing Symfony again, gosh - I hope they had added more docs... Most of us are doing this in our free time, so give it a break will you. Instead of spamming the mailing list with how badly you want to switch to symfony, i rather see you helping out with the documentation! -- Andries Seutens http://andries.systray.be Gecontroleerd op virussen door de JOJO Secure Gateway. -- Olivier Sirven Elma Ingénierie Informatique Groupe Maximiles S.A. 3 rue d'Uzès F-75002 - Paris - France Pho. 33-144949901 Fax. 33-144882747
Re: [fw-general] bootstrap controller setup...
Are you doing: include 'Zend/Loader.php'; at the top of the bootstrap? On 3/19/07, ZegeeDotCom [EMAIL PROTECTED] wrote: Still nothing...here is the revised bootstrap file: Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::getInstance(); $front-throwExceptions(true); $front = Zend_Controller_Front::run('../application/controllers'); Zend_Loader::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); $front-setParam('view', $view ) still, my views are not generated ZegeeDotCom wrote: I am not seeing anything. No errors, no html and I thought that maybe I am setting up the controller incorrectly: include Zend/Loader.php; Zend_Loader::loadClass('Zend_Controller_Front'); $front = Zend_Controller_Front::run('../application/controllers'); $front-throwExceptions(true); does this look good enough? in my previous 0.8 framework, things worked really well... -- View this message in context: http://www.nabble.com/bootstrap-controller-setup...-tf3427552s16154.html#a9554529 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Db_Table_Row __get()
Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a937 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend_Db_Table_Row __get()
It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend_Db_Table_Row __get()
Basic problem is that the pdo adapter has: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); You will have to figure out how to change it to CASE_NATURAL. Even then I suspect you might have trouble with case sensitivity. I myself rather liked the camel case conversion. It being dropped is one of the reasons I gave up on Zend_Db. It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend_Db_Table_Row __get()
I don't understand why the camel case conversion has been dropped? As far as I can see all variables (in ZF) are camelCased, even the PDF document Best Practices of PHP Development written by Zend states that all variables should be camelCased. So why change it for Zend_Db? Doesn't seem to make much sense as an element of consistency has been lost here. -Original Message- From: Art Hundiak [mailto:[EMAIL PROTECTED] Sent: 19 March 2007 16:42 To: fw-general@lists.zend.com Subject: RE: [fw-general] Zend_Db_Table_Row __get() Basic problem is that the pdo adapter has: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); You will have to figure out how to change it to CASE_NATURAL. Even then I suspect you might have trouble with case sensitivity. I myself rather liked the camel case conversion. It being dropped is one of the reasons I gave up on Zend_Db. It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Cleanup Zend_Request
There are several other request types, GET, HEAD, PUT, DELETE, TRACE, CONNECT etc. I'm not sure of which can be associated with PHP, but I know that HEAD at least can be handled by PHP/framework. The getHeader methods in Zend_Response should probably be unified like Request as well for consistency; further, the API might be bumped between raw/associative header to make this a little more simple. setHeader($spec, $value=null, $flags=null) ... where value is null add a raw header, then add a flag for replacement/whatever else. Kevin - Original Message - From: Matthew Weier O'Phinney [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, March 19, 2007 4:02 AM Subject: Re: [fw-general] Cleanup Zend_Request -- Kevin McArthur [EMAIL PROTECTED] wrote (on Sunday, 18 March 2007, 05:50 PM -0700): and also create isGet (or isQuery) to complement isPost A request is either a POST or a GET. If you want to see if something was a GET request, use: if (!$request-isPost()) { // GET request } It doesn't really make sense to support both since it's a boolean and the possibilities are GET or POST. The decision to use isPost() is due to the fact that most request methods will be GET anyways; you'll typically code a check for a POST request. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
RE: [fw-general] Zend_Db_Table_Row __get()
Doesn't seem to make much sense as an element of consistency has been lost here. Hmm. Good point. -Original Message- From: Jon [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:53 AM To: fw-general@lists.zend.com Subject: RE: [fw-general] Zend_Db_Table_Row __get() I don't understand why the camel case conversion has been dropped? As far as I can see all variables (in ZF) are camelCased, even the PDF document Best Practices of PHP Development written by Zend states that all variables should be camelCased. So why change it for Zend_Db? Doesn't seem to make much sense as an element of consistency has been lost here. -Original Message- From: Art Hundiak [mailto:[EMAIL PROTECTED] Sent: 19 March 2007 16:42 To: fw-general@lists.zend.com Subject: RE: [fw-general] Zend_Db_Table_Row __get() Basic problem is that the pdo adapter has: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); You will have to figure out how to change it to CASE_NATURAL. Even then I suspect you might have trouble with case sensitivity. I myself rather liked the camel case conversion. It being dropped is one of the reasons I gave up on Zend_Db. It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Um... is something wrong with FishEye?
All files in trunk are shown as deleted, and reference DbTable-09. -Matt
[fw-general] RE: Zend_Db_Table_Row __get()
I tried this solution, modifiying /Zend/Db/Pdo/Abstract line 95: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); to // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); and now the app completely crashes with many notices like: Notice: Undefined index: field in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 139 Notice: Undefined index: field in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 142 Notice: Undefined index: type in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 144 Notice: Undefined index: default in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 145 Notice: Undefined index: null in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 146 Notice: Undefined index: key in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 151 I looked it up and its the describeTable function within MySQL's extension of the PDO. Any ideas? Art Hundiak wrote: Basic problem is that the pdo adapter has: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); You will have to figure out how to change it to CASE_NATURAL. Even then I suspect you might have trouble with case sensitivity. I myself rather liked the camel case conversion. It being dropped is one of the reasons I gave up on Zend_Db. It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a9556665 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] RE: Zend_Db_Table_Row __get()
I remember a post by a month ago that stated something similar to the following: maintain field names from tables when accessing/manipulating data form a Row. In other words one should assume they can access properties of the Row as they are described in the field names. I think this approach is safe, but we either need to use something like this, or choose a convention. -Will Doesn't seem to make much sense as an element of consistency has been lost here. Hmm. Good point. -Original Message- From: Jon [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:53 AM To: fw-general@lists.zend.com Subject: RE: [fw-general] Zend_Db_Table_Row __get() I don't understand why the camel case conversion has been dropped? As far as I can see all variables (in ZF) are camelCased, even the PDF document Best Practices of PHP Development written by Zend states that all variables should be camelCased. So why change it for Zend_Db? Doesn't seem to make much sense as an element of consistency has been lost here. -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a9556705 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Controller_Action _forward method call in class init() doesn't forward to different class/module
Thanks, that's perfect. :) On 19 Mar 2007, at 17:45, Matthew Weier O'Phinney wrote: -- Nick Thornley [EMAIL PROTECTED] wrote (on Monday, 19 March 2007, 05:24 PM +): I'm trying to forward from within the init() function of a Controller to an action in a different controller, but it is only using the action argument - forwarding only within the current controller. for example, in my class firstController extends Zend_Controller_Action I add into the init() method $this-_forward('myAction','second'); //forward to secondController::myAction Then (provided the action doesn't exist in firstController) an exception is thrown showing: firstController::myactionAction() does not exist ie. It is just forwarding to the specified action within the current controller. (The same thing occurs when specifying modules as well.) If the code is anywhere other than init(), it works as you would expect. Have I missed something, and this is intentionally so by design, or is it a bug? By design. init() is for object initialization -- primarily setting up the action controller environment. The call to set the dispatched flag happens *after* object instantiation, but *before* preDispatch() is called. Hence, you'll want to run your code from your action controller's preDispatch() method (or from a preDispatch() plugin). -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] RE: Zend_Db_Table_Row __get()
I did say that changing it might cause more problems. And sure enough it appears that other components assume column names are lower case. So basically I don't think you can have mixed case column names. Funny thing is that someone from Zend just committed this change to svn. Wonder if they ran the unit tests before hand? Wonder if we even have tests for the table object? Not in the delivery package. I tried this solution, modifiying /Zend/Db/Pdo/Abstract line 95: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); to // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); and now the app completely crashes with many notices like: Notice: Undefined index: field in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 139 Notice: Undefined index: field in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 142 Notice: Undefined index: type in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 144 Notice: Undefined index: default in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 145 Notice: Undefined index: null in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 146 Notice: Undefined index: key in /../library/Zend/Db/Adapter/Pdo/Mysql.php on line 151 I looked it up and its the describeTable function within MySQL's extension of the PDO. Any ideas? Art Hundiak wrote: Basic problem is that the pdo adapter has: // force names to lower case $this-_connection-setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); You will have to figure out how to change it to CASE_NATURAL. Even then I suspect you might have trouble with case sensitivity. I myself rather liked the camel case conversion. It being dropped is one of the reasons I gave up on Zend_Db. It appears that all column preparation has been removed on each row. 0.8 Usage: CREATE TABLE `accounts` ( `id` int(11) NOT NULL auto_increment, `date_entered` datetime default NULL, `date_modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; foreach($this-account as $account) { echo $account-dateModified; } Current 0.9 Usage: (untested) foreach($this-account as $account) { echo $account-date_modified; } I never liked the camel-casing. I found it confusing. I like the 0.9 usage better because I know exactly what to expect. The camel-casing limited system predictability. (This can of course be argued both ways). Bug? Feature? -Original Message- From: Aaron Egaas [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 10:26 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Db_Table_Row __get() Hello, Prior to 0.9, I was using underscored field names in my MySQL database and relying on Zend_Db's inflector to produce nice Camel-cased field names within the Zend framework. Since 0.9 with the inflector gone, I switched my field name in the database to camel case so I didn't have to refactor a lot of code. Unforunately I think I found a bug when I did this. All over my app I get exceptions saying the field (jobId for example) isn't found! I dumped out the Db_Row and all the fieldnames have been lower cased. I'm using MySQL's PDO. Anyone know whats causing my plight? -Aaron Egaas -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a95 55537 Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Zend_Db_Table_Row-__get%28%29-tf3428196s16154.html#a9556665 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Filter_Input / accessing $_POST
Quick question I hope isn't too dumb.. I've noticed ZF 0.9 has dropped the functionality of accessing the $_POST superglobal via Zend_Filter_Input. Pre 0.9 once you'd accessed POST via Zend_Filter_Input you were forced to access POST subsequently via Zend_Filter_Input. This seemed to me, at the time, a good idea. Now POST vars are left where they always were, i.e. $_POST[{name}] or $this-_request-getPost('{name}'). I missed any mailing list discussion on this, so can I ask what the reasoning behind this was so I can understand why it's now structured in this way thanks, Si
[fw-general] Great work with 0.9
Thank you so much! What can I say, I'm developing several big applications which ZF and even with the API changes from 0.8 took a while to fix I applaud for them. Sure there are bugs and inconsistencies both in manual and the framework itself but it does not make it unusable. I understand that people want to be on the bleeding edge and so on but lets give the developers a break with a cookie or two. Just think about where you would be without ZF. Maybe writing filter for user input? Maybe some SQL? Maybe implementing your version of ACL and Auth? Yes, it can be fruitful to do those for personal experience but in a business world that's simply a no-no. Let's all take a break with a cookie :)
RE: [fw-general] Zend_Filter_Input / accessing $_POST
Thanks for the speedy reply Tony best wishes, Simon
RE: [fw-general] primary key-less table...
Not currently. But I am trying to implement support for sequences, natural keys, and compound keys soon. Some database experts say that a table without a primary key is not a table. :-) Regards, Bill Karwin From: Adam Balgach [mailto:[EMAIL PROTECTED] Sent: Monday, March 19, 2007 11:58 AM To: Zend Mailing List Subject: [fw-general] primary key-less table... is Zend_Db_Table capable of handling a table in the db, where there is no primary key defined? Just wondering...
RE: [fw-general] Great work with 0.9
I third that! We looked around hard and wide for a decent framework to use for our company and settled on Zend Framework 6 months ago. The progress since then has been fabulous and has certainly validating my decision to go with ZF. Excellent work everyone :-) Si
Re: [fw-general] Great work with 0.9
+1 Wonderfull work, and really a pleasure to develop with :-) Aurélien. I third that! We looked around hard and wide for a decent framework to use for our company and settled on Zend Framework 6 months ago. The progress since then has been fabulous and has certainly validating my decision to go with ZF. Excellent work everyone :-) Si
RE: [fw-general] Zend_Db Exception throwing?
FYI, you can also do this: $db-getConnection(); No need to execute a dummy query. The getConnection() method initiates the connection if one has not already been made. Regards, Bill Karwin -Original Message- From: Jude Aakjaer [mailto:[EMAIL PROTECTED] Sent: Monday, March 19, 2007 2:09 AM To: Zend Framework General Subject: Re: [fw-general] Zend_Db Exception throwing? Excellent thanks. I've added in a SELECT 1 query inside my try/catch block to grab a connection error now -Jude A. On Mon, 19 Mar 2007 17:11:54 +0900, Alexander Netkachev [EMAIL PROTECTED] wrote: Zend_Db_Adapter does not create a connection to the database when you create it. The real PDO Connection is created when you execute first query or create instance of Zend_Db_Table class. So, the try/catch block does not catch this exception just because it is fired later in the code, when the real connection is created. Sincerely,
Re: [fw-general] Great work with 0.9
Just FYI, The 0.9.0 svn tag is missing: http://framework.zend.com/svn/framework/tag/ On 3/19/07, Simon R Jones [EMAIL PROTECTED] wrote: I third that! We looked around hard and wide for a decent framework to use for our company and settled on Zend Framework 6 months ago. The progress since then has been fabulous and has certainly validating my decision to go with ZF. Excellent work everyone :-) Si
Re: [fw-general] Zend_Db_Table_Row __get()
Jon wrote: I don't understand why the camel case conversion has been dropped? As far as I can see all variables (in ZF) are camelCased, even the PDF document Best Practices of PHP Development written by Zend states that all variables should be camelCased. So why change it for Zend_Db? Doesn't seem to make much sense as an element of consistency has been lost here. The camel casing caused no end of trouble here as it created inconsistencies between data retrieved via Zend_Db_Table and data retrieved directly via Zend_Db or plain old SQL. We ended up having to iterate over data retreived via normal SQL to call Zend_Inflector on it, which wasn't good. Personally, I like it that I get a one to one mapping from table name to PHP variable name and it is predictable and doesn't require any thought. Regards, Rob...
[fw-general] $db-setRowClass $db-setRowsetClass
Hi guys, this email will be a little long to explain my confusion, please bear with me. I am trying to create some domain logic in my result objects so I have access to methods on rowsets and rows. It kinda works, but kinda doesn't. Unfortunately I think I am either missing something completely, or what I'm trying to do just isn't possible. I am using the latest nightly build. This all came from wanting to change this: $article = $db-query($sql)-fetchObject(__CLASS__); Here's my error: Fatal error: Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Unrecognized method 'helloWorld()'' in D:\_php\www\includes\Zend\Db\Table\Row\Abstract.php Well, that's obvious - I'm trying to access a non-existent method. However, here's some code. I hope that you'll be able to understand at a glance what I'm trying to do. I have stripped out most of my un-needed code. I can verify that the database has connected, and the view object does exist. class AccountsController extends BootstrapController { public function indexAction() { $accounts = new Accounts(); $this-view-accounts = $accounts-fetchAll(); Zend_Debug::dump($this-view-accounts); // debug foreach($this-view-accounts as $account) { echo $account-helloWorld(); // This is the cause of our problem } } } class Accounts extends Zend_Db_Table { public function _setup($config = array()) { $this-_name = 'accounts'; $this-setRowClass('Account'); // this seems to be ignored $this-setRowsetClass('AccountsRowset'); parent::_setup($config); } } class AccountsRowset extends Zend_Db_Table_Rowset { public function _setup($config = array()) { $this-_name = 'accounts'; $this-setRowClass('Account'); // this seems to be ignored parent::_setup($config); } } class Account extends Zend_Db_Table_Row { public function _setup($config = array()) { $this-_name = 'accounts'; parent::_setup($config); } public function helloWorld() { return 'hello ' . $this-name; } } Now. When I look at the dump(), I can see the data. The row class and rowset class is being set. However, it is still calling Zend_Db_Table_Row. To aid in debugging, here is my dump. object(AccountsRowset)#20 (8) { [_data:protected] = array(2) { [0] = array(7) { [id] = string(1) 1 [date_entered] = string(19) 2007-03-17 21:24:38 [date_modified] = NULL [created_by] = string(1) 1 [assigned_user_id] = NULL [name] = string(1) d [deleted] = NULL } [1] = array(7) { [id] = string(1) 2 [date_entered] = string(19) 2007-03-19 11:45:17 [date_modified] = NULL [created_by] = string(1) 1 [assigned_user_id] = NULL [name] = string(4) [deleted] = NULL } } [_table:protected] = object(Accounts)#19 (8) { [_db:protected] = object(Zend_Db_Adapter_Pdo_Mysql)#12 (5) { [_pdoType:protected] = string(5) mysql [_config:protected] = array(6) { [dbtype] = string(9) pdo_mysql [host] = string(9) localhost [username] = string(4) root [password] = string(0) [dbname] = string(3) crm [debugEnabled] = string(4) true } [_fetchMode:protected] = int(2) [_profiler:protected] = object(Zend_Db_Profiler)#14 (4) { [_queryProfiles:protected] = array(0) { } [_enabled:protected] = bool(false) [_filterElapsedSecs:protected] = NULL [_filterTypes:protected] = NULL } [_connection:protected] = object(PDO)#17 (0) { } } [_name:protected] = string(8) Accounts [_cols:protected] = array(7) { [0] = string(2) id [1] = string(12) date_entered [2] = string(13) date_modified [3] = string(10) created_by [4] = string(16) assigned_user_id [5] = string(4) name [6] = string(7) deleted } [_primary:protected] = string(2) id [_rowClass:protected] = string(7) Account [_rowsetClass:protected] = string(14) AccountsRowset [_referenceMap:protected] = array(0) { } [_dependentTables:protected] = array(0) { } } [_connected:protected] = bool(true) [_tableClass:protected] = string(8) Accounts [_rowClass:protected] = string(17) Zend_Db_Table_Row [_pointer:protected] = int(0) [_count:protected] = int(2) [_rows:protected] = array(0) { } } I'm hoping someone can help me out. I'm kinda at a loss. -Ryan
[fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php'; $view-actiontemplate ='index.tpl.php'; $view-htmlbase='http://www.zegee.net'; $view-index_headline='index_headline.tpl.php'; $view-index_news='index_news.tpl.php'; $view-index_packages='index_packages.tpl.php'; $view-index_analysis='index_analysis.tpl.php'; $view-index_client_trainer_gym='index_client_trainer_gym.tpl.php'; $this-_response-setBody($view-render('index_template.tpl.php')); } The above works, but how do I convert it to 0.9 ? Thank you Rob Marscher wrote: ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559151 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Clear example of full working bootstrap please
if you could package it as a zip that would have been wonderful...I will do anything to get this working Rob Allen-3 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 ZegeeDotCom wrote: atch(); Can someone give a FULL working example of setting up a bootstrap and a controller together to display a hello world? If you have SVN, do: svn checkout http://svn.akrabat.com/svn/zf-tutorial/trunk/ tutorial/ and have a look at my tutorial code. If you haven't I'll package up into a Zip file for you. Regards, Rob... -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF/uQ4421+qn4cITwRAkY3AKCdfVnndfKVH1FxWRaclaSmYrjWmgCcCNh7 r2c6jAWoW4G/IGE0duDEtGM= =AUCY -END PGP SIGNATURE- -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559390 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] $db-setRowClass $db-setRowsetClass
Update: Now I know I've missed something. In my debugging process, here's what I did. Open: Zend/DB/Table/Rowset/Abstract.php Goto Line: 71 Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row' With: protected $_rowClass = 'Account' Have access to Account-helloWorld(); I'll keep digging, I seem to be missing a step along the way. -Ryan PS: Undo changes, save. ;) _ From: Ryan Brooks [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 1:32 PM To: fw-general@lists.zend.com Subject: [fw-general] $db-setRowClass $db-setRowsetClass Hi guys, this email will be a little long to explain my confusion, please bear with me. I am trying to create some domain logic in my result objects so I have access to methods on rowsets and rows. It kinda works, but kinda doesn't. Unfortunately I think I am either missing something completely, or what I'm trying to do just isn't possible. I am using the latest nightly build. This all came from wanting to change this: $article = $db-query($sql)-fetchObject(__CLASS__); Here's my error: Fatal error: Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Unrecognized method 'helloWorld()'' in D:\_php\www\includes\Zend\Db\Table\Row\Abstract.php Well, that's obvious - I'm trying to access a non-existent method. However, here's some code. I hope that you'll be able to understand at a glance what I'm trying to do. I have stripped out most of my un-needed code. I can verify that the database has connected, and the view object does exist. class AccountsController extends BootstrapController { public function indexAction() { $accounts = new Accounts(); $this-view-accounts = $accounts-fetchAll(); Zend_Debug::dump($this-view-accounts); // debug foreach($this-view-accounts as $account) { echo $account-helloWorld(); // This is the cause of our problem } } } class Accounts extends Zend_Db_Table { public function _setup($config = array()) { $this-_name = 'accounts'; $this-setRowClass('Account'); // this seems to be ignored $this-setRowsetClass('AccountsRowset'); parent::_setup($config); } } class AccountsRowset extends Zend_Db_Table_Rowset { public function _setup($config = array()) { $this-_name = 'accounts'; $this-setRowClass('Account'); // this seems to be ignored parent::_setup($config); } } class Account extends Zend_Db_Table_Row { public function _setup($config = array()) { $this-_name = 'accounts'; parent::_setup($config); } public function helloWorld() { return 'hello ' . $this-name; } } Now. When I look at the dump(), I can see the data. The row class and rowset class is being set. However, it is still calling Zend_Db_Table_Row. To aid in debugging, here is my dump. object(AccountsRowset)#20 (8) { [_data:protected] = array(2) { [0] = array(7) { [id] = string(1) 1 [date_entered] = string(19) 2007-03-17 21:24:38 [date_modified] = NULL [created_by] = string(1) 1 [assigned_user_id] = NULL [name] = string(1) d [deleted] = NULL } [1] = array(7) { [id] = string(1) 2 [date_entered] = string(19) 2007-03-19 11:45:17 [date_modified] = NULL [created_by] = string(1) 1 [assigned_user_id] = NULL [name] = string(4) [deleted] = NULL } } [_table:protected] = object(Accounts)#19 (8) { [_db:protected] = object(Zend_Db_Adapter_Pdo_Mysql)#12 (5) { [_pdoType:protected] = string(5) mysql [_config:protected] = array(6) { [dbtype] = string(9) pdo_mysql [host] = string(9) localhost [username] = string(4) root [password] = string(0) [dbname] = string(3) crm [debugEnabled] = string(4) true } [_fetchMode:protected] = int(2) [_profiler:protected] = object(Zend_Db_Profiler)#14 (4) { [_queryProfiles:protected] = array(0) { } [_enabled:protected] = bool(false) [_filterElapsedSecs:protected] = NULL [_filterTypes:protected] = NULL } [_connection:protected] = object(PDO)#17 (0) { } } [_name:protected] = string(8) Accounts [_cols:protected] = array(7) { [0] = string(2) id [1] = string(12) date_entered [2] = string(13) date_modified [3] = string(10) created_by [4] = string(16) assigned_user_id [5] = string(4) name [6] = string(7) deleted } [_primary:protected] = string(2) id [_rowClass:protected] = string(7) Account [_rowsetClass:protected] = string(14) AccountsRowset [_referenceMap:protected] = array(0) { } [_dependentTables:protected] = array(0) { } }
Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
From viewing you bootstrap I found 2 quick eyecatcher... Zend::loadClass has been changed to Zend_Loader::loadClass Zend::register has also changed (Zend_Registy::register ??) Greetings Thomas - Original Message - From: ZegeeDotCom [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, March 19, 2007 8:41 PM Subject: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php'; $view-actiontemplate ='index.tpl.php'; $view-htmlbase='http://www.zegee.net'; $view-index_headline='index_headline.tpl.php'; $view-index_news='index_news.tpl.php'; $view-index_packages='index_packages.tpl.php'; $view-index_analysis='index_analysis.tpl.php'; $view-index_client_trainer_gym='index_client_trainer_gym.tpl.php'; $this-_response-setBody($view-render('index_template.tpl.php')); } The above works, but how do I convert it to 0.9 ? Thank you Rob Marscher wrote: ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559151 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Great work with 0.9
I think ZF is wonderful. +1 +1. I've been following it since it was announced. I've written some php scripts in the past to make some desktop applications information available on the web but had not attempted a full blown application in php until now, and I'm very happy with the progress I've made to this point. It takes me a while to get the hang of things, but I've been able to get something out of each version. At first I struggle to get mod_rewrite working and the boot strap file. I got a 'hello world' type of app going with a view and the controller. Learned about the registry, then I got connected to my MySql database. Played with the pdf. Incorporated config with and .ini file. Move on to the rewrite controller and eventually to using Parms. Then read something about autoload and got that working. Added ACL and then Auth. Coded my own dynamic menu that utilizes Auth and ACL to determine what menu items should be provided to the user. I'm using plugins and cache among many other things I've forgot to mention. Its been a great experience. I'm glad I've been here as it evolved because I feel that I was exposed to much more then I would have been post version 1.0. I look forward to the future and hope to evolve enough to make contributions beyond a newbies view. -- View this message in context: http://www.nabble.com/Great-work-with-0.9-tf3429024s16154.html#a9560027 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
Zend_Registry::set - Original Message - From: Thomas Weidner [EMAIL PROTECTED] To: ZegeeDotCom [EMAIL PROTECTED]; fw-general@lists.zend.com Sent: Monday, March 19, 2007 1:18 PM Subject: Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. From viewing you bootstrap I found 2 quick eyecatcher... Zend::loadClass has been changed to Zend_Loader::loadClass Zend::register has also changed (Zend_Registy::register ??) Greetings Thomas - Original Message - From: ZegeeDotCom [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, March 19, 2007 8:41 PM Subject: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php'; $view-actiontemplate ='index.tpl.php'; $view-htmlbase='http://www.zegee.net'; $view-index_headline='index_headline.tpl.php'; $view-index_news='index_news.tpl.php'; $view-index_packages='index_packages.tpl.php'; $view-index_analysis='index_analysis.tpl.php'; $view-index_client_trainer_gym='index_client_trainer_gym.tpl.php'; $this-_response-setBody($view-render('index_template.tpl.php')); } The above works, but how do I convert it to 0.9 ? Thank you Rob Marscher wrote: ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559151 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
* At the top of your bootstrap, include both 'Zend/Loader.php' and 'Zend/Registry.php' instead of 'Zend.php' * Rewrite all instances of Zend::loadClass(xxx) to Zend_Loader::loadClass(xxx) [However - read the tip in the documentation. loadClass has no real benefit if your class is not a variable. You'd be better off with a require_once] * Rewrite all instances of Zend::register(xxx, yyy) to Zend_Registry::set(xxx, yyy) * Rewrite all instances of Zend::registry(xxx) to Zend_Registry::get (xxx) * The Zend_Filter_Input class has been deprecated - for the moment you'll have to do without it (no complaining! there's already been enough and a solution is on the way) * If there's no post-processing of your response required, you may wish to set preferences prior to execution and have it auto-render:- Replace:- //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); With:- require_once('Zend/Controller/Response/Http.php'); $response = new Zend_Controller_Response_Http(); $response-renderExceptions(true); $frontController-setResponse($response); $frontController-dispatch(); * Why are you enclosing all of your bootstrap within a function call? If you aren't getting any output, you may wish to set breakpoints before and after your view render() to ensure program execution is flowing as expected. There's nothing too tricky about your code so I shouldn't imagine after the above changes you'll have too much trouble. Re: documentation, it's all there currently and I believe you're being overly-harsh. After all, not only does it exist (and with 0.9- specific code in there) but it also exists in over 10 languages! I think the problem is more that you've grown accustomed to the pre 0.9 code and have been bitten by some API changes that make it seem a lot worse than it is. I can happily say I've had to change some apps 3 times since 0.1.5 but each upgrade has helped me streamline and refactor my code into something a lot better. Have fun! My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/ controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/ errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php';
Re: [fw-general] $db-setRowClass $db-setRowsetClass
Hi Ryan I had a quick look at your table/row definitions. This will work:- class Accounts extends Zend_Db_Table { protected $_name = 'accounts'; protected $_rowClass = 'Account'; } You don't need the extra Rowset definition if there's no specific functionality you need to add - in most cases the default rowSet class is adequate. What puzzles me is that your '$this-setRowClass('Account')' _should_ have worked. I'll do some digging later to see if anything is awry and post a JIRA issue if it turns out to be the case. Cheers Update: Now I know I’ve missed something. In my debugging process, here’s what I did. Open: Zend/DB/Table/Rowset/Abstract.php Goto Line: 71 Replace Value of: protected $_rowClass = ‘Zend_Db_Table_Row’ With: protected $_rowClass = ‘Account’ Have access to Account-helloWorld(); I’ll keep digging, I seem to be missing a step along the way. -Ryan PS: Undo changes, save. ;) -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
[fw-general] ZF Beta needs revision to 0.9.1
Hi all, Clearly there are some rough edges in the upgrade to Zend Framework 0.9.0. I would like to suggest a plan to release an update to the Beta by the end of this week. So we will revise the version number to 0.9.1 Beta, and we'll focus on fixing bugs, improving doc, and writing more tests. My intention is to do a code-freeze on Thursday evening at 9:00pm Pacific time, and the release will be made on Friday. Regards, Bill Karwin
RE: [fw-general] Um... is something wrong with FishEye?
Are you looking at the DbTable-09 branch in FishEye? I deleted the branch after confirming that the changes were merged to the trunk. Sometimes FishEye also seems to take a lunch break once in a while as it updates revision data from svn. So if you have troubles, try again in 20 minutes or so. Regards, Bill Karwin -Original Message- From: Matthew Ratzloff [mailto:[EMAIL PROTECTED] Sent: Monday, March 19, 2007 10:01 AM To: fw-general@lists.zend.com Subject: [fw-general] Um... is something wrong with FishEye? All files in trunk are shown as deleted, and reference DbTable-09. -Matt
RE: [fw-general] $db-setRowClass $db-setRowsetClass
In Zend_Db_Table_Abstract::fetchAll() we have $data = array( 'table'= $this, 'data' = $this-_fetch('All', $where, $order, $count, $offset), 'rowclass' = $this-_rowClass ); return new $this-_rowsetClass($data); And in Zend_Db_Table_Rowset_Abstract::__construct() we have: if (isset($config['rowClass'])) { $this-_rowClass = $config['rowClass']; } Almost as though the code was released without testing. Which I guess is consistent with the fact that there are no DB_Table/Row tests in the delivered version. Hi Simon, Yup, setting protected $_rowClass = 'Account'; does work. However, I plan on lazy loading a lot of my definitions so I can do something like: class Accounts extends Custom_Db_Table_Which_Extends_Zend_Db_Table implements Custom_Action_Insert_Delete_Authorize { public function _setup($config = array()) { $this-_name = __CLASS__; $this-setRowClass( Utility_String_Ucfirst::returnString( Utility_String_Inflector_Singularize::returnString( $this-_name))); parent::_setup($config); } } Really it's six in one and half a dozen in the other, just a personal preference, seeing how far I can push ZF. Unfortunately, this method didn't work from my initial tests, bringing us to the problem at hand. Alas, I do need the custom rowset. I have some methods on the entire resultset that I'd like to use in the future. (For instance, pagination utilizing view helpers). I'd really like if you (or someone) can poke around and see what's going wrong, if anything. Otherwise my experience during my upgrade has been very positive. Thanks! Hope to hear from you soon! -Ryan _ From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 2:35 PM To: Ryan Brooks Cc: fw-general@lists.zend.com Subject: Re: [fw-general] $db-setRowClass $db-setRowsetClass Hi Ryan I had a quick look at your table/row definitions. This will work:- class Accounts extends Zend_Db_Table { protected $_name = 'accounts'; protected $_rowClass = 'Account'; } You don't need the extra Rowset definition if there's no specific functionality you need to add - in most cases the default rowSet class is adequate. What puzzles me is that your '$this-setRowClass('Account')' _should_ have worked. I'll do some digging later to see if anything is awry and post a JIRA issue if it turns out to be the case. Cheers Update: Now I know I've missed something. In my debugging process, here's what I did. Open: Zend/DB/Table/Rowset/Abstract.php Goto Line: 71 Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row' With: protected $_rowClass = 'Account' Have access to Account-helloWorld(); I'll keep digging, I seem to be missing a step along the way. -Ryan PS: Undo changes, save. ;) -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
Re: [fw-general] Module name not available in bootstrap file
Thanks Jude A Your response, I believe is the way to go. But I modified it just a bit because I was worried that I was doubling up on creating a router in my bootstrap and in the controller when it was dispatched. $router = $frontController-getRouter(); // router is a singleton $request = new Zend_Controller_Request_Http(); $router-route($request); // run $frontController-dispatch($request); Thanks all David Procak santouras wrote: I'm not sure if this is what you were aiming to do, but this sounded like a similar problem I was tackling. I wanted to know what module was going to be used before I dispatched as there would be varying requirements for each. In my case it is the difference between an admin section and a client section. Using this code let me see what the current module is. //Create a router and request object $router = new Zend_Controller_Router_Rewrite(); $request = new Zend_Controller_Request_Http(); $router-route($request); echo $request-getModuleName(); I hope this helps you out -Jude A. On Fri, 16 Mar 2007 13:20:17 +0900, david pr [EMAIL PROTECTED] wrote: Hi, I am trying to use modules. It is half successful - my controllers are being found in the appropriate directory - my problem is I want to set the view script path to the appropriate module but the module name is only available after the front controller is dispatched. I can see in /Zend/Controller/Front.php that the module is set when the following code is executed in function dispatch():- $router-route($request); But I can't see how I can set up the router before dispatching. I don't want to set up my view's script path in every controller. I would like to do it in the bootstrap file. I can't see how I can easily do this. Find below a snippet of my bootstrap file. Can someone help please? version 0.8.0 index.php (snippet) $module =$frontController-getRequest()-getModuleName(); /* returns blank */ // initialize view Zend::loadClass($viewClassName); $view = new $viewClassName(); $view-setScriptPath($module/application/views'); Zend::register('view', $view); // run $frontController-dispatch(); $module =$frontController-getRequest()-getModuleName(); /* returns correct module name */ -- View this message in context: http://www.nabble.com/Module-name-not-available-in-bootstrap-file-tf3412535s16154.html#a9561209 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] $db-setRowClass $db-setRowsetClass
Hi Simon, Art friends, Thanks to Art's awesome debugging prowess (I.e. he saw something that I didn't) it turns out that this entire problem was due to a typo in Zend_Db_Table_Abstract. The fix follows: GOTO: Line 582 FIND CODE BLOCK: $data = array( 'table'= $this, 'data' = $this-_fetch('All', $where, $order, $count, $offset), 'rowclass' = $this-_rowClass ); REPLACE WITH: $data = array( 'table'= $this, 'data' = $this-_fetch('All', $where, $order, $count, $offset), 'rowClass' = $this-_rowClass ); Commit at your leisure. I have tested this initially and it seems to work for me. I will continue to advise as I use. Simon, Art, thanks for your help! -Ryan PS: Simon, I'll look into getting some unit tests going. -Original Message- From: Art Hundiak [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 3:18 PM To: Ryan Brooks Cc: 'Simon Mundy'; fw-general@lists.zend.com Subject: RE: [fw-general] $db-setRowClass $db-setRowsetClass In Zend_Db_Table_Abstract::fetchAll() we have $data = array( 'table'= $this, 'data' = $this-_fetch('All', $where, $order, $count, $offset), 'rowclass' = $this-_rowClass ); return new $this-_rowsetClass($data); And in Zend_Db_Table_Rowset_Abstract::__construct() we have: if (isset($config['rowClass'])) { $this-_rowClass = $config['rowClass']; } Almost as though the code was released without testing. Which I guess is consistent with the fact that there are no DB_Table/Row tests in the delivered version. Hi Simon, Yup, setting protected $_rowClass = 'Account'; does work. However, I plan on lazy loading a lot of my definitions so I can do something like: class Accounts extends Custom_Db_Table_Which_Extends_Zend_Db_Table implements Custom_Action_Insert_Delete_Authorize { public function _setup($config = array()) { $this-_name = __CLASS__; $this-setRowClass( Utility_String_Ucfirst::returnString( Utility_String_Inflector_Singularize::returnString( $this-_name))); parent::_setup($config); } } Really it's six in one and half a dozen in the other, just a personal preference, seeing how far I can push ZF. Unfortunately, this method didn't work from my initial tests, bringing us to the problem at hand. Alas, I do need the custom rowset. I have some methods on the entire resultset that I'd like to use in the future. (For instance, pagination utilizing view helpers). I'd really like if you (or someone) can poke around and see what's going wrong, if anything. Otherwise my experience during my upgrade has been very positive. Thanks! Hope to hear from you soon! -Ryan _ From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: March 19, 2007 2:35 PM To: Ryan Brooks Cc: fw-general@lists.zend.com Subject: Re: [fw-general] $db-setRowClass $db-setRowsetClass Hi Ryan I had a quick look at your table/row definitions. This will work:- class Accounts extends Zend_Db_Table { protected $_name = 'accounts'; protected $_rowClass = 'Account'; } You don't need the extra Rowset definition if there's no specific functionality you need to add - in most cases the default rowSet class is adequate. What puzzles me is that your '$this-setRowClass('Account')' _should_ have worked. I'll do some digging later to see if anything is awry and post a JIRA issue if it turns out to be the case. Cheers Update: Now I know I've missed something. In my debugging process, here's what I did. Open: Zend/DB/Table/Rowset/Abstract.php Goto Line: 71 Replace Value of: protected $_rowClass = 'Zend_Db_Table_Row' With: protected $_rowClass = 'Account' Have access to Account-helloWorld(); I'll keep digging, I seem to be missing a step along the way. -Ryan PS: Undo changes, save. ;) -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
RE: [fw-general] $db-setRowClass $db-setRowsetClass
Thanks for catching that bug, Art. For the record, there *are* unit tests for Zend_Db_Table/Row/Rowset. The code coverage is 68%. Look in zf-home/tests/Zend/Db/Adapter/Common.php, there are 37 test functions matching testTable*. I wish you would not say that there are no tests for these classes. It is a false statement. It is true that the line containing the bug was not covered by unit tests. But it is an exaggeration to say that there are no tests covering the Table/Row classes. Regards, Bill Karwin -Original Message- From: Art Hundiak [mailto:[EMAIL PROTECTED] Almost as though the code was released without testing. Which I guess is consistent with the fact that there are no DB_Table/Row tests in the delivered version.
RE: [fw-general] Um... is something wrong with FishEye?
Hmm, I don't think that's it. Take a look at this page (from the trunk): http://framework.zend.com/fisheye/browse/Zend_Framework/trunk/library/Zend Look at the individual files (Acl.php, Auth.php, etc.). I see them all as deleted and referencing DbTable-09. Things like Debug.php and Loader.php are fine, but if you go deeper (say, under the Controller directory), all the files that should be there are marked deleted as well. It affects the entire framework. -Matt On Mon, March 19, 2007 1:42 pm, Bill Karwin wrote: Are you looking at the DbTable-09 branch in FishEye? I deleted the branch after confirming that the changes were merged to the trunk. Sometimes FishEye also seems to take a lunch break once in a while as it updates revision data from svn. So if you have troubles, try again in 20 minutes or so. Regards, Bill Karwin -Original Message- From: Matthew Ratzloff [mailto:[EMAIL PROTECTED] Sent: Monday, March 19, 2007 10:01 AM To: fw-general@lists.zend.com Subject: [fw-general] Um... is something wrong with FishEye? All files in trunk are shown as deleted, and reference DbTable-09. -Matt