Re: [fw-general] class name instead of table name in reference map (Zend_Db)
Thank you Bill for this detailed answer. I'll implement the solution you suggest. Bill Karwin wrote: Guillaume Oriol wrote: I wonder why the developpers of Zend_Db component choose the class name instead of column name in the reference map of a Zend_Db_Table object? I designed and implemented the table-relationships feature. The answer to your question of why is that the reference map is to help the Zend_Db_Table_Row object to instantiate related Table objects. It has nothing to do with designing custom SQL queries. You are using the $_referenceMap in a manner other than what it was designed for. You could just as easily say, I want to hammer in a nail. I have a screwdriver, but it has a tip that isn't flat or blunt, so it's hard to use for nailing. I wonder why the screwdriver was designed this way? That's not to say that what you are doing is in any way wrong. Hammering nails is a fine thing to do in many circumstances. It's just that the $_referenceMap doesn't contain the information to help you, so it's not the right tool. I need to build dynamically my joins in a findBy* method and try to build them from the existing reference map. But to do so, I need the referenced table name, not the table class name. As the $_referenceMap only contains the table class name, I am obliged to instantiate the class just to get its table name! Is there a better way to do so? The $_referenceMap is simply a PHP associative array. You can add elements to it and use them in your custom methods. protected $_referenceMap = array( 'Bug' = array( 'columns' = array('bug_id'), 'refTableClass' = 'Bugs', 'refColumns'= array('bug_id'), // You can add a custom array element for example: 'guillaume_table_name'= 'bugs_tbl', ) ); You can use whatever string you want as the array key. The above is just an example. Zend_Db_Table_Row_Abstract expects some array keys, that that are documented, but you can create other keys in the same array too. Another solution is to name your Table classes the same as the database tables they represent. This is the default, by the way. Only if you declare a Table class including the $_name attribute does it use that name instead of the name of the class. class bugs extends Zend_Db_Table_Abstract { // no need to declare $_name if the class name is the same as the table name } Note that if you do this, your table name should conform to PEAR class naming conventions. E.g. a class named bugs_tbl should be defined in file bugs/tbl.php. Regards, Bill Karwin - Guillaume ORIOL Sofware architect Technema -- View this message in context: http://www.nabble.com/class-name-instead-of-table-name-in-reference-map-%28Zend_Db%29-tp19860024p19872857.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Dojo capturestart/end inserting a '1'
When I use any capturestart/captureend for rendering out content panes, accordion panes, etc., There is a '1' inserted into the div for the widget. Is there a way to suppress this? Thanks! -- View this message in context: http://www.nabble.com/Dojo-capturestart-end-inserting-a-%271%27-tp19872912p19872912.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Dojo capturestart/end inserting a '1'
Ken Petri wrote: When I use any capturestart/captureend for rendering out content panes, accordion panes, etc., There is a '1' inserted into the div for the widget. Is there a way to suppress this? Thanks! Try to remove the '=' in the first tag of php code. before: ?= code ? ?= code... ? After: ? code...? ?= code ...? -- View this message in context: http://www.nabble.com/Dojo-capturestart-end-inserting-a-%271%27-tp19872912p19873815.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Catching catched exceptions
Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19874696.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Catching catched exceptions
Hello Marcelo, It's basically something like this: try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { echo Something is wrong...; exit(); } I could modify the catch part and do some redirection or something similar, but the code has many SQL calls like this. I don't want to change each one manually. Marcello Duarte wrote: What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19875942.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Where to store classes? Model?
-- sinkingfish [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 02:43 AM -0700): Im currently in the early stages of setting up a zf based site. I want to put out a question about where to store different classes. I have object classes (eg a user class with getters and setters), I have factory classes for instantiating the object classes and I have database classes for accessing the database. What Im wondering is where to save these files? Do they all belong in the models folder, or do just the database classes belong there? I also have a library folder containing the zend framework and my own personal library for the project. Do the object classes and factorys belong in the library folder too? It depends. Are these classes ones that you'll re-use between projects, or are they application-specific? or are they specific to a given application module? Typically, the rule of thumb is that if they are specific to the application or application module, they go in the models directory; if they are something you'll re-use between applications and modules, they would go in your library. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Zend_Loader_PluginLoader problems
This is what I get with 11666: *Fatal error*: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name CmsScripts was not found in the registry; paths searched: array ( 'Admin_View_Helper_' = array ( 0 = 'D:/werkmap/www.houthandelwijers.nl zf/application/admin/views\\helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', ), ) Original include_path: .;C:\Program Files\PHP\pear;c:\php\includes;c:\php\PEAR\;c:\php;D:\ZendFramework\library' in D:\ZendFramework\library\Zend\Loader\PluginLoader.php:404 Stack trace: #0 D:\ZendFramework\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-load('CmsScripts') #1 D:\ZendFramework\library\Zend\View\Abstract.php(545): Zend_View_Abstract-_getPlugin('helper', 'cmsScripts') #2 D:\ZendFramework\library\Zend\View\Abstract.php(312): Zend_View_Abstract-getHelper('cmsScripts') #3 [internal function]: Zend_View_Abstract-__call('cmsScripts', Array) #4 D:\ZendFramework\library\SpaceCMS\ActionController.php(44): Zend_View-cmsScripts() #5 D:\ZendFr in *D:\ZendFramework\library\Zend\Loader\PluginLoader.php* on line *404 *So I'll just revert back to 10753 for now!* :-) *Bart* * Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 11:17 AM +0200): I updated the Loader dir to 10753 and it works again now. Revision 11629 is the one that broke it. That makes sense -- I made changes as of r11666 that should have fixed it. Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 09:10 PM +0200): Hi all, I had similar problems today with my custom view helpers. They are in the location where ZF is looking for them, but it can't load them. I thought I sent a mail to the list about it, but it probably got rejected. The only thing I could think of is the directory separator... I can see you are on windows too. In my case, everything worked before and now nothing does, because the helpers aren't found by the plugin loader. I'm pretty certain it's an OS-dependent bug, and will be working when I can to fix this the next few days. The loader works by adding to the include path the directories required... Bart Codiac schreef: Matthew, It's probably my setup but I'm still experiencing problems. I'm not using the incubator and I'm trying to load the Zend_View_Helper_Translate. It works fine for the login page, but after that it somehow goes wrong. Here's a little more info. #0 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-gt;load('Translate') #1 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(545): Zend_View_Abstract-gt;_getPlugin('helper', 'translate') #2 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(312): Zend_View_Abstract-gt;getHelper('translate') #3 [internal function]: Zend_View_Abstract-gt;__call('translate', Array) #4 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\D Wms\d_wms\default\views\scripts\index\index.php(3): Zend_View-gt;translate('INDEX_PAGE_001') Regards, TJ. Matthew Weier O'Phinney-3 wrote: -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:45 AM -0400): -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:27 AM -0400): -- Codiac [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 02:25 AM -0700): I'm experiencing some errors while loading a plugin (in this case the translate view helper). I'm seeing what appears to be escaped directory separators in the include path. Is this somehow related to the changes in Zend_Loader_PluginLoader how it handles plugin loading? Here are the details: Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Translate was not found in the registry; paths searched: array ( 'D_View_Helper_' = array ( 0 = 'C:\\Documents and Settings\\Mijn
[fw-general] Checkbox, can't toggle anymore, wrong checkValue (1.6.1)
In ZF 1.5.2, you could use a checkbox to toggle between 0 and 1. (Without specifying any values in your config) Now, in ZF 1.6.1, this doesn't work any more. In the the static function, determineCheckboxInfo from the FormCheckbox viewhelper there is a check if the value !== null. Then the unCheckedValue will be set with the value of self::$_defaultCheckedOptions['unChecked'] but checkedValue remains null. Later on in the function there is a check if the checkedValue is null and if so, then the checkedValue will be set to the value given to the function. So that means that if the initial value of the checkbox is 0 (so checkbox is unChecked), only the unCheckedValue will be set with the default value. This means that checkedValue remains null and will be changed to 0 in the last if-statement. So this results in a checkedValue of 0 and an unCheckedValue of 0. So you can't toggle anymore because the value will always be 0. Is this the new expected behaviour or is this a bug? It seems related to http://framework.zend.com/issues/browse/ZF-4274 but without the use of Dojo For the moment, I changed on line 135 } elseif ($value !== null) { to } elseif ($value !== null $value != self::$_defaultCheckedOptions['unChecked']) { to make it backwards compatible -- View this message in context: http://www.nabble.com/Checkbox%2C-can%27t-toggle-anymore%2C-wrong-checkValue-%281.6.1%29-tp19859507p19859507.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Loader_PluginLoader problems
-- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 04:11 PM -0400): -- Bart McLeod [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 09:10 PM +0200): I had similar problems today with my custom view helpers. They are in the location where ZF is looking for them, but it can't load them. I thought I sent a mail to the list about it, but it probably got rejected. The only thing I could think of is the directory separator... I can see you are on windows too. In my case, everything worked before and now nothing does, because the helpers aren't found by the plugin loader. I'm pretty certain it's an OS-dependent bug, and will be working when I can to fix this the next few days. I've run unit tests in Windows now, and had no errors. Unfortunately, I'm having trouble getting my vhosts working (can you tell I spend *no* time in windows? :-P ), so I have not yet tested a practical example. However, since Bart has also responded that recent revisions are working for him, I'll defer for a day or two while I finish up other tasks. The loader works by adding to the include path the directories required... Bart Codiac schreef: Matthew, It's probably my setup but I'm still experiencing problems. I'm not using the incubator and I'm trying to load the Zend_View_Helper_Translate. It works fine for the login page, but after that it somehow goes wrong. Here's a little more info. #0 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-gt;load('Translate') #1 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(545): Zend_View_Abstract-gt;_getPlugin('helper', 'translate') #2 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(312): Zend_View_Abstract-gt;getHelper('translate') #3 [internal function]: Zend_View_Abstract-gt;__call('translate', Array) #4 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\D Wms\d_wms\default\views\scripts\index\index.php(3): Zend_View-gt;translate('INDEX_PAGE_001') Regards, TJ. Matthew Weier O'Phinney-3 wrote: -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:45 AM -0400): -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:27 AM -0400): -- Codiac [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 02:25 AM -0700): I'm experiencing some errors while loading a plugin (in this case the translate view helper). I'm seeing what appears to be escaped directory separators in the include path. Is this somehow related to the changes in Zend_Loader_PluginLoader how it handles plugin loading? Here are the details: Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Translate was not found in the registry; paths searched: array ( 'D_View_Helper_' = array ( 0 = 'C:\\Documents and Settings\\Mijn documenten\\Projecten\\Workspace\\Wms\\wms\\views\\helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', 1 = 'C:/Documents and Settings/Mijn documenten/Projecten/Workspace/Wms/wms/default/views\\helpers/', ), ) The escapes above are because I use var_export to create the message -- which will escape backslashes in strings so they may be evaluated properly by PHP. So, that's not the issue. I've just verified problems loading the translate view helper when I have a custom helper path in place, so I'll continue looking for the source of the issue. Actually, I take that back -- the helper was found. However, because I had display_errors on, I was distracted by the warnings. Now I need to find out why the warning errors are showing since they should be suppressed. Issue was that the version of the incubator was conflicting with the one in trunk. I've now removed the incubator version, and I'm no longer seeing the warnings. Please update and verify. Original include_path: .;C:\xampp\php\pear\;C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\; C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Framework\library' in C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\Loader\PluginLoader.php:404 Stack trace: #0 C:\Documents and Settings\Taco\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstr in C:\Documents and Settings\Taco\Mijn documenten\Projecten\Workspace\Zend Framework
[fw-general] broken view helper paths (again)
Hi All, Just updated from svn/standard and my apps are broken. *Fatal error*: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name LanguageChoice was not found in the registry; paths searched: array ( 'View_Helper_' = array ( 0 = 'D:/werkmap/www.houthandelwijers.nl zf/application/layouts/helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', ), ) Original include_path: .;C:\Program Files\PHP\pear;c:\php\includes;c:\php\PEAR\;c:\php;D:\ZendFramework\library' in D:\ZendFramework\library\Zend\Loader\PluginLoader.php:404 Stack trace: #0 D:\ZendFramework\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-load('LanguageChoice') #1 D:\ZendFramework\library\Zend\View\Abstract.php(545): Zend_View_Abstract-_getPlugin('helper', 'languageChoice') #2 D:\ZendFramework\library\Zend\View\Abstract.php(312): Zend_View_Abstract-getHelper('languageChoice') #3 [internal function]: Zend_View_Abstract-__call('languageChoice', Array) #4 D:\werkmap\www.houthandelwijers.nl zf\application\layouts\layout.phtml(21): Zend_View- in *D:\ZendFramework\library\Zend\Loader\PluginLoader.php* on line *404 I didn't change a thing in my code.* Maybe something with directory separtors. The location the loader is looking in is correct. D:/werkmap/www.houthandelwijers.nl zf/application/layouts/helpers/LanguageChoice.php is the name of the helper and /View_Helper_LanguageChoice/ is the class name. So I think it should work like before. Any help appreciated. Bart
[fw-general] Lucene Optimize Memory Exhausted
Hello, I am getting this fatal error when I try to optimize my index: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 42 bytes) I am currently indexing about 116,000 items. Total index size is about 60MB. Lucene settings: $MAX_BUFFERED_DOCS = 100; $MERGE_FACTOR = 20; Does anybody know how I can reduce the memory footprint of the optimize function? Thanks! -- View this message in context: http://www.nabble.com/Lucene-Optimize-Memory-Exhausted-tp19823729p19823729.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Where to store classes? Model?
Thanks for the reply I was planning on having 3 folders in my library folder: 1. the Zend folder 2. a core folder (which I intend putting reusable classes, eg authentication etc) 3. an application specific library, for classes specific to this project. I was planning on having 2 folders in the models folder: 1. a core folder, containing the object classes, factories database accessors for the parts of the site / database structure which I can share with other sites in the future. 2. an application specific folder, same as the one above, containing the object classes, factories database accessors for the parts of the site / database structure. My question really is where is the most logical place to store my object classes factories, in the library or in the model folder? My initial thought would be in the model as they are for interacting with data. And then keep processing etc in the library. Thanks Matthew Weier O'Phinney-3 wrote: -- sinkingfish [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 02:43 AM -0700): Im currently in the early stages of setting up a zf based site. I want to put out a question about where to store different classes. I have object classes (eg a user class with getters and setters), I have factory classes for instantiating the object classes and I have database classes for accessing the database. What Im wondering is where to save these files? Do they all belong in the models folder, or do just the database classes belong there? I also have a library folder containing the zend framework and my own personal library for the project. Do the object classes and factorys belong in the library folder too? It depends. Are these classes ones that you'll re-use between projects, or are they application-specific? or are they specific to a given application module? Typically, the rule of thumb is that if they are specific to the application or application module, they go in the models directory; if they are something you'll re-use between applications and modules, they would go in your library. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Where-to-store-classes--Model--tp19875577p19878021.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Where to store classes? Model?
Hi, Im currently in the early stages of setting up a zf based site. I want to put out a question about where to store different classes. I have object classes (eg a user class with getters and setters), I have factory classes for instantiating the object classes and I have database classes for accessing the database. What Im wondering is where to save these files? Do they all belong in the models folder, or do just the database classes belong there? I also have a library folder containing the zend framework and my own personal library for the project. Do the object classes and factorys belong in the library folder too? Thanks for the direction :) -- View this message in context: http://www.nabble.com/Where-to-store-classes--Model--tp19875577p19875577.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Db_Select Order By
hi, i can't use order by like that: $select-order(b.status = 'new'); Error Message : *Fatal error*: Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 'b.status = 'new'' in 'order clause'' in ... Thanks for helps, -- Elvin Şiriyev
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
I'm actually having the exact same problem as the OP with this one, except my code works just fine - I can validate the form no problem, I just can't get it to validate on a tab that loads behind the currently selected one. I am lazy loading my tabs like: ?= $this-contentPane('new-record', '', array('title' = $this-titles['new-title'], 'class' = 'tab', 'href' = /record/new/format/ajax, 'parseOnLoad' = true)) ? because it lets me use $this- correctly, but it also breaks the Javascript I put in the view, like it just never gets called. I'm scratching my head to think of a way around this in Zend. Anyone got the same problem? vladimirn wrote: So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19875163.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Test + setcookie() = error
-- Tir [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 02:23 AM -0700): In one of my plugins i set cookie in preDispatch method with the setcookie function. And when i try to test my controllers with descendant of the Zend_Test_PHPUnit_ControllerTestCase class i receive an error Cannot modify header information - headers already sent by. I think it occures because i set cookie with PHP native function, not with method of ZF classes. How can i set cookies to have no error ocurred? Actually... we don't have a way in the Response object yet for setting cookies; if we had one, that would make testing easier. I've added a ticket for you to track this: http://framework.zend.com/issues/browse/ZF-4520 -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Catching catched exceptions
There's no cheap way of catching a exception alread catched. I'd suggest you looked into changing you catch block. Let the external components deal with the exception. While you don't have you code ready to deal with the exception, a mid-term fix could be throwing another Exception from catch. try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { throw new My_Db_Exception; } In your exception constructor deal with the exception as you are thinking of. Will that work for you? Mauricio Cuenca wrote: Hello Marcelo, It's basically something like this: try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { echo Something is wrong...; exit(); } I could modify the catch part and do some redirection or something similar, but the code has many SQL calls like this. I don't want to change each one manually. Marcello Duarte wrote: What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19876265.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Db_Select Order By
Hi, Try something like: $select-where('b.status = ?', 'new')- order('b.status ASC'); On 8 Oct 2008, at 13:22, Elvin Şiriyev wrote: hi, i can't use order by like that: $select-order(b.status = 'new'); Error Message : Fatal error: Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 'b.status = 'new'' in 'order clause'' in ... Thanks for helps, -- Elvin Şiriyev
Re: [fw-general] Catching catched exceptions
What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19875672.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Loader_PluginLoader problems
-- Bart McLeod [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 12:10 PM +0200): This is what I get with 11666: Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name CmsScripts was not found in the registry; paths searched: array ( 'Admin_View_Helper_' = array ( 0 = 'D:/werkmap/ www.houthandelwijers.nl zf/application/admin/views\\helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', ), ) Original include_path: .;C:\Program Files\PHP\pear;c:\php\includes;c:\php\PEAR\;c:\php; D:\ZendFramework\library' in D:\ZendFramework\library\Zend\Loader\ PluginLoader.php:404 Stack trace: #0 D:\ZendFramework\library\Zend\View\ Abstract.php(1114): Zend_Loader_PluginLoader-load('CmsScripts') #1 D:\ ZendFramework\library\Zend\View\Abstract.php(545): Zend_View_Abstract- _getPlugin('helper', 'cmsScripts') #2 D:\ZendFramework\library\Zend\View\ Abstract.php(312): Zend_View_Abstract-getHelper('cmsScripts') #3 [internal function]: Zend_View_Abstract-__call('cmsScripts', Array) #4 D:\ZendFramework\ library\SpaceCMS\ActionController.php(44): Zend_View-cmsScripts() #5 D:\ZendFr in D:\ZendFramework\library\Zend\Loader\PluginLoader.php on line 404 So I'll just revert back to 10753 for now! :-) Okay, so it's still an issue on Windows, then. I'll keep digging. Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 11:17 AM +0200): I updated the Loader dir to 10753 and it works again now. Revision 11629 is the one that broke it. That makes sense -- I made changes as of r11666 that should have fixed it. Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 09:10 PM +0200): Hi all, I had similar problems today with my custom view helpers. They are in the location where ZF is looking for them, but it can't load them. I thought I sent a mail to the list about it, but it probably got rejected. The only thing I could think of is the directory separator... I can see you are on windows too. In my case, everything worked before and now nothing does, because the helpers aren't found by the plugin loader. I'm pretty certain it's an OS-dependent bug, and will be working when I can to fix this the next few days. The loader works by adding to the include path the directories required... Bart Codiac schreef: Matthew, It's probably my setup but I'm still experiencing problems. I'm not using the incubator and I'm trying to load the Zend_View_Helper_Translate. It works fine for the login page, but after that it somehow goes wrong. Here's a little more info. #0 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-gt;load('Translate') #1 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(545): Zend_View_Abstract-gt;_getPlugin('helper', 'translate') #2 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(312): Zend_View_Abstract-gt;getHelper('translate') #3 [internal function]: Zend_View_Abstract-gt;__call('translate', Array) #4 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\D Wms\d_wms\default\views\scripts\index\index.php(3): Zend_View-gt;translate('INDEX_PAGE_001') Regards, TJ. Matthew Weier O'Phinney-3 wrote: -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:45 AM -0400): -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:27 AM -0400): -- Codiac [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 02:25 AM -0700): I'm experiencing some errors while loading a plugin (in this case the translate view helper). I'm seeing what appears to be escaped directory
Re: [fw-general] Catching catched exceptions
Hi Luke, Thanks for your answer, this a little bit accomplishes what I was aiming for. I have to touch each try/catch block though. What I conclude about this is that is better for my future application to not have try/catch blocks any at all. Just have the main one in the bootstrap and let it do the job. Am I right or not catching individual exceptions is not a good approach? Thanks! Luke Richards wrote: Hi try { $result = $db-query(...); $db-update(...); // other code } catch(Exception $e) { // do something here throw $e } The important bit is that you are re-throwing the exception that you've caught. Alternatively you could throw a new exception but you'll loose the context data stored in the exception such as where the original error occurred. The error controller should by default be setup to catch the exception. Hope that helps. Luke Mauricio Cuenca wrote: Hello Marcelo, It's basically something like this: try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { echo Something is wrong...; exit(); } I could modify the catch part and do some redirection or something similar, but the code has many SQL calls like this. I don't want to change each one manually. Marcello Duarte wrote: What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19876374.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Form Zend_Dojo::enableForm() bugs?
Two bugs i think, both occur when you dojo enable a form. version 1.6.1 e.g. 1. This : $form = new Zend_Form(); Zend_Dojo::enableForm($form); $form-addElement('text', 'foo', array('label' = 'bar')); echo $form; will output : form enctype=application/x-www-form-urlencoded action= method=post name=dl class=zend_form dtlabel for=foo class=optionalbar/label/dt dd input type=text name=foo id=foo value=/dd/dl/form Notice the empty name attribute, name=. 2. All textarea elements break when a form with custom decorators is dojo enabled. Am i doing something wrong here? e.g. The following will break with the error Catchable fatal error: Argument 4 passed to Zend_Dojo_View_Helper_Textarea::textarea() must be an array, null given in path\to\Zend\1.6.1\library\Zend\Dojo\View\Helper\Textarea.php on line 64 $form = new Zend_Form(); Zend_Dojo::enableForm($form); $form-setDecorators(array( 'Description', 'Errors', 'FormElements', 'Form' )); $form-addElement('textarea', 'foo', array( 'decorators' = array( 'Description', 'Errors', 'ViewHelper', array('Label'), array('HtmlTag', array('tag'='li')) ), 'label' = 'bar' ) ); $form-addDisplayGroup( array('foo'), 'foobar', array( 'decorators' = array( 'FormElements', array('HtmlTag', array('tag'='ul')), 'Fieldset' ), 'legend' = 'FooBar' ) ); echo $form; -- View this message in context: http://www.nabble.com/Zend_Form---Zend_Dojo%3A%3AenableForm%28%29-bugs--tp19878670p19878670.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
-- Themselves [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 02:12 AM -0700): I'm actually having the exact same problem as the OP with this one, except my code works just fine - I can validate the form no problem, I just can't get it to validate on a tab that loads behind the currently selected one. I am lazy loading my tabs like: ?= $this-contentPane('new-record', '', array('title' = $this-titles['new-title'], 'class' = 'tab', 'href' = /record/new/format/ajax, 'parseOnLoad' = true)) ? because it lets me use $this- correctly, but it also breaks the Javascript I put in the view, like it just never gets called. I'm scratching my head to think of a way around this in Zend. Anyone got the same problem? This is actually not a PHP issue, but a Dojo issue, and even more generally, a JS issue. Basically, XHR doesn't allow execution of script contents returned. So, when you lazy-load content panes, the view script returning the content cannot contain script tags that contain javascript; if they are returned, they're ignored. Dojo, of course, has some ways around this, by allowing you to provide script tags with a type of 'dojo/*', where '*' is one of a limited set of types -- content, method, particular events etc. Read more about this in the Dojo manual. My pastebin example has a few examples: * For the grid, I had one like the following to connect row clicks: script type=dojo/method event=onSelected args=inRowIndex var row = dijit.byId(activePastes).model.getRow(inRowIndex); location.href = ?= $this-baseUrl() ?/paste/display/id/ + row.id; /script * For the forms I lazy load, I had stuff like the following: script type=dojo/connect event=onLoad dojo.connect(dojo.byId('pasteform'), 'onsubmit', function () { dojo.byId('pasteform-code').value = dijit.byId('pasteform-codeEditor').getValue(false); }); /script Note, however, that all your dojo.require statements will need to be provided up front, in the original page load; otherwise, your parseOnLoad is going to fail due to missing dependencies. I've found that this is a good excuse to start building a good layer file (which will also help you later when you go to create a custom build). Again, the pastebin example shows exactly that. vladimirn wrote: So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19875163.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Zend_Loader_PluginLoader problems
-- Bart McLeod [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 11:17 AM +0200): I updated the Loader dir to 10753 and it works again now. Revision 11629 is the one that broke it. That makes sense -- I made changes as of r11666 that should have fixed it. Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 09:10 PM +0200): Hi all, I had similar problems today with my custom view helpers. They are in the location where ZF is looking for them, but it can't load them. I thought I sent a mail to the list about it, but it probably got rejected. The only thing I could think of is the directory separator... I can see you are on windows too. In my case, everything worked before and now nothing does, because the helpers aren't found by the plugin loader. I'm pretty certain it's an OS-dependent bug, and will be working when I can to fix this the next few days. The loader works by adding to the include path the directories required... Bart Codiac schreef: Matthew, It's probably my setup but I'm still experiencing problems. I'm not using the incubator and I'm trying to load the Zend_View_Helper_Translate. It works fine for the login page, but after that it somehow goes wrong. Here's a little more info. #0 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-gt;load('Translate') #1 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(545): Zend_View_Abstract-gt;_getPlugin('helper', 'translate') #2 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(312): Zend_View_Abstract-gt;getHelper('translate') #3 [internal function]: Zend_View_Abstract-gt;__call('translate', Array) #4 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\D Wms\d_wms\default\views\scripts\index\index.php(3): Zend_View-gt;translate('INDEX_PAGE_001') Regards, TJ. Matthew Weier O'Phinney-3 wrote: -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:45 AM -0400): -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:27 AM -0400): -- Codiac [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 02:25 AM -0700): I'm experiencing some errors while loading a plugin (in this case the translate view helper). I'm seeing what appears to be escaped directory separators in the include path. Is this somehow related to the changes in Zend_Loader_PluginLoader how it handles plugin loading? Here are the details: Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Translate was not found in the registry; paths searched: array ( 'D_View_Helper_' = array ( 0 = 'C:\\Documents and Settings\\Mijn documenten\\Projecten\\Workspace\\Wms\\wms\\views\\helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', 1 = 'C:/Documents and Settings/Mijn documenten/Projecten/Workspace/Wms/wms/default/views\\helpers/', ), ) The escapes above are because I use var_export to create the message -- which will escape backslashes in strings so they may be evaluated properly by PHP. So, that's not the issue. I've just verified problems loading the translate view helper when I have a custom helper path in place, so I'll continue looking for the source of the issue. Actually, I take that back -- the helper was found. However, because I had display_errors on, I was distracted by the
[fw-general] Zend_Test + setcookie() = error
Hi, all! In one of my plugins i set cookie in preDispatch method with the setcookie function. And when i try to test my controllers with descendant of the Zend_Test_PHPUnit_ControllerTestCase class i receive an error Cannot modify header information - headers already sent by. I think it occures because i set cookie with PHP native function, not with method of ZF classes. How can i set cookies to have no error ocurred? -- View this message in context: http://www.nabble.com/Zend_Test-%2B-setcookie%28%29-%3D-error-tp19834606p19834606.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Loader_PluginLoader problems
I updated the Loader dir to 10753 and it works again now. Revision 11629 is the one that broke it. Regards, Bart McLeod Matthew Weier O'Phinney schreef: -- Bart McLeod [EMAIL PROTECTED] wrote (on Monday, 06 October 2008, 09:10 PM +0200): Hi all, I had similar problems today with my custom view helpers. They are in the location where ZF is looking for them, but it can't load them. I thought I sent a mail to the list about it, but it probably got rejected. The only thing I could think of is the directory separator... I can see you are on windows too. In my case, everything worked before and now nothing does, because the helpers aren't found by the plugin loader. I'm pretty certain it's an OS-dependent bug, and will be working when I can to fix this the next few days. The loader works by adding to the include path the directories required... Bart Codiac schreef: Matthew, It's probably my setup but I'm still experiencing problems. I'm not using the incubator and I'm trying to load the Zend_View_Helper_Translate. It works fine for the login page, but after that it somehow goes wrong. Here's a little more info. #0 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(1114): Zend_Loader_PluginLoader-gt;load('Translate') #1 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(545): Zend_View_Abstract-gt;_getPlugin('helper', 'translate') #2 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstract.php(312): Zend_View_Abstract-gt;getHelper('translate') #3 [internal function]: Zend_View_Abstract-gt;__call('translate', Array) #4 C:\Documents and Settings\Mijn documenten\Projecten\Workspace\D Wms\d_wms\default\views\scripts\index\index.php(3): Zend_View-gt;translate('INDEX_PAGE_001') Regards, TJ. Matthew Weier O'Phinney-3 wrote: -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:45 AM -0400): -- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 11:27 AM -0400): -- Codiac [EMAIL PROTECTED] wrote (on Sunday, 05 October 2008, 02:25 AM -0700): I'm experiencing some errors while loading a plugin (in this case the translate view helper). I'm seeing what appears to be escaped directory separators in the include path. Is this somehow related to the changes in Zend_Loader_PluginLoader how it handles plugin loading? Here are the details: Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Translate was not found in the registry; paths searched: array ( 'D_View_Helper_' = array ( 0 = 'C:\\Documents and Settings\\Mijn documenten\\Projecten\\Workspace\\Wms\\wms\\views\\helpers/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', 1 = 'C:/Documents and Settings/Mijn documenten/Projecten/Workspace/Wms/wms/default/views\\helpers/', ), ) The escapes above are because I use var_export to create the message -- which will escape backslashes in strings so they may be evaluated properly by PHP. So, that's not the issue. I've just verified problems loading the translate view helper when I have a custom helper path in place, so I'll continue looking for the source of the issue. Actually, I take that back -- the helper was found. However, because I had display_errors on, I was distracted by the warnings. Now I need to find out why the warning errors are showing since they should be suppressed. Issue was that the version of the incubator was conflicting with the one in trunk. I've now removed the incubator version, and I'm no longer seeing the warnings. Please update and verify. Original include_path: .;C:\xampp\php\pear\;C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\; C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Framework\library' in C:\Documents and Settings\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\Loader\PluginLoader.php:404 Stack trace: #0 C:\Documents and Settings\Taco\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\View\Abstr in C:\Documents and Settings\Taco\Mijn documenten\Projecten\Workspace\Zend Framework (Core)\library\Zend\Loader\PluginLoader.php on line 404 Thanks, TJ. Matthew Weier O'Phinney-3 wrote: -- Pieter Kokx [EMAIL PROTECTED] wrote (on Saturday, 04 October 2008, 11:12 PM
Re: [fw-general] Catching catched exceptions
Hi try { $result = $db-query(...); $db-update(...); // other code } catch(Exception $e) { // do something here throw $e } The important bit is that you are re-throwing the exception that you've caught. Alternatively you could throw a new exception but you'll loose the context data stored in the exception such as where the original error occurred. The error controller should by default be setup to catch the exception. Hope that helps. Luke Mauricio Cuenca wrote: Hello Marcelo, It's basically something like this: try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { echo Something is wrong...; exit(); } I could modify the catch part and do some redirection or something similar, but the code has many SQL calls like this. I don't want to change each one manually. Marcello Duarte wrote: What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks!
Re: [fw-general] Catching catched exceptions
I wouldn't renounce using try/catch altogether. They are important for object's messaging. They are not merely errors handlers. Exceptions are themselves objects sending a message when a rule is broken. Construct you try/catch hierarchy so that it is extensible. That is, don't catch unless you are at a level of your application to decide logically/graphically wise how to handle the exception. Mauricio Cuenca wrote: What I conclude about this is that is better for my future application to not have try/catch blocks any at all. Just have the main one in the bootstrap and let it do the job. Am I right or not catching individual exceptions is not a good approach? -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19877880.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Catching catched exceptions
If you can, just remove the try catch block and don't use it like that any more. You shouldn't catch an exception at all unless you can do something about it. Karol Mauricio Cuenca wrote: Hello Marcelo, It's basically something like this: try { $result = $dbconn-query(SELECT * FROM TABLE); } catch (Exception $e) { echo Something is wrong...; exit(); } I could modify the catch part and do some redirection or something similar, but the code has many SQL calls like this. I don't want to change each one manually. Marcello Duarte wrote: What code is in your catch statement? Mauricio Cuenca wrote: Hello, I have an application that started small and now its big. The problem is that each database transaction has a try/catch statement. Now I want to capture all those exceptions and send them to the error controller to display friendly error messages to users in the production environment. Is there a way to force the Error Controller to catch this already catched exceptions without modifying each sql try/catch block in the code? Thanks! -- View this message in context: http://www.nabble.com/Catching-catched-exceptions-tp19874696p19877623.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Form Zend_Dojo::enableForm() bugs?
-- gerardroche [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 06:25 AM -0700): Two bugs i think, both occur when you dojo enable a form. version 1.6.1 e.g. 1. This : $form = new Zend_Form(); Zend_Dojo::enableForm($form); First, if you're going to use Dojo elements and you're building the form programatically anyways, just use Zend_Dojo_Form instead of Zend_Form. It saves you a step, and will be more efficient in the long run. $form-addElement('text', 'foo', array('label' = 'bar')); echo $form; will output : form enctype=application/x-www-form-urlencoded action= method=post name=dl class=zend_form dtlabel for=foo class=optionalbar/label/dt dd input type=text name=foo id=foo value=/dd/dl/form Notice the empty name attribute, name=. This is because you did not specify a name or ID to the form object. 2. All textarea elements break when a form with custom decorators is dojo enabled. Am i doing something wrong here? e.g. The following will break with the error Catchable fatal error: Argument 4 passed to Zend_Dojo_View_Helper_Textarea::textarea() must be an array, null given in path\to\Zend\1.6.1\library\Zend\Dojo\View\Helper\Textarea.php on line 64 snip $form-addElement('textarea', 'foo', array( 'decorators' = array( 'Description', 'Errors', 'ViewHelper', Don't use 'ViewHelper' here -- use 'DijitElement'. array('Label'), array('HtmlTag', array('tag'='li')) ), 'label' = 'bar' ) ); -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Unable to programatically create filteringSelect
Bump. Tried several ways to fix the issue. None of them worked so far. Can anybody give me a clue? Hi all, I have a custom js script in which I am trying to create an input element with filteringSelect widget when clicked on a button. I have tested the script with just an HTML file and it works great. However, I'm lost when trying to integrate the same functionality to the application which uses Zend_Dojo. In this particular page, there are other input elements with filteringSelect widget created by Zend_Form_Dojo that also work well. Here is my view script: view script--- ?php echo $this-form; //what follows below is another form to test the functionality ? form name=moreFields id=moreFields method=post action= div id=moreInput /div input type=button onclick=moreWidgets() value=More/ input type=hidden name=totalProducts id=totalProducts value= input type=submit name=submit value=submit /form view script--- I have the following snippet in the layout script ---layout script--- ?php echo $this-dojo()-addStylesheetModule('dijit.themes.tundra'); ? script type=text/javascript src=/js/bizsense.js /script script type=text/javascript src=/js/custom/purchase.js /script ---layout script--- The custom js script - /js/custom/purchase.js ollows: custom js script-- var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: productId[ + counter + ], searchAttr: productName }, list); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; dojo.byId(moreInput).appendChild(filteringSelect.domNode); //Create quantity and append it to the form var quantity = document.createElement(input); quantity.setAttribute(type, text); quantity.setAttribute(name, quantity[ + counter + ]); quantity.setAttribute(width, 50px); quantity.setAttribute(size, 5); dojo.byId(moreInput).appendChild(quantity); //Create price and append it to the formvar price = document.createElement(input); price.setAttribute(type, text); price.setAttribute(name, price[ + counter + ]); price.setAttribute(width, 50px); price.setAttribute(size, 5); dojo.byId(moreInput).appendChild(price); var lineBreak = document.createElement(br); dojo.byId(moreInput).appendChild(lineBreak); //Set total // dojo.byId(totalProducts).value = counter; } dojo.addOnLoad(function() { moreWidgets()}) custom js script-- When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message root is null si = root.selectedIndex;file /js/dojo...mboBox.js (line 1051) in firebug console. How do I get the script to create new element with filteringSelect widget? Any help is greatly appreciated.
Re: [fw-general] Dojo capturestart/end inserting a '1'
Alessandro Camilli wrote: Ken Petri wrote: When I use any capturestart/captureend for rendering out content panes, accordion panes, etc., There is a '1' inserted into the div for the widget. Is there a way to suppress this? Thanks! Try to remove the '=' in the first tag of php code. before: ?= code ? ?= code... ? After: ? code...? ?= code ...? Thanks Alessandro. I went through the application and removed the = from all captureStart lines of code. This has fixed the problem. With the standalone helpers--ones where I'm not using captureStart/End but just declaring the helper as a single enclosed chunk of code--the = needs to stay in. Can you or anyone explain why this fix is necessary? I noticed it is necessary whether you use the short_php_tags syntax or use an echo. -- View this message in context: http://www.nabble.com/Dojo-capturestart-end-inserting-a-%271%27-tp19872912p19880708.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Mail_Storage and FilterIterator
Hi Bartosz! The mail number starts with 1. You initialize the LimitIterator with 0 instead of 1, which throws an exception (try $mail[0];). Seems like iterator_to_array() eats that exception. If you don't need an array, and I don't see a reason, I would also avoid converting the iterator to an array. Mail storage classes can be used like an array and most of the time you'd use foreach, which works with every iterator. nico Bartosz Maciaszek wrote: Hello everyone, I'd like to limit the Zend_Mail_Storage_Imap iterator using LimitIterator, so what I do is: $mail = new Zend_Mail_Storage_Imap(array('host' = localhost, 'user' = 'test', 'password' = 'secret')); $mail = new LimitIterator($mail, 0, 50); print_r(iterator_to_array($mail)); But all I get is empty array. Am I doing something wrong or the implementation od Zend_Mail_Storage_* is incorrect? Regards, Bartosz
Re: [fw-general] Unable to programatically create filteringSelect
Sudheer wrote: var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: productId[ + counter + ], searchAttr: productName }, list); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; [...] When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message root is null si = root.selectedIndex;file /js/dojo...mboBox.js (line 1051) in firebug console. I would have asked the question in the dojo forums. But anyway ... here is a guess. Line 1051 in ComboBox.js is dijit.form._ComboBoxDataStore.fetchSelectedItem(). That's the store, which uses a select node instead of a normal store. So I think you should first create the store and give that as a param to the constructor of dijit.form.FilteringSelect. BTW in firebug you can normally check which line of your code causes the error, with the backtrace and the function parameters in the trace. Or you set breakpoint, add watches and step through the code to see what goes wrong. nico
Re: [fw-general] Dojo capturestart/end inserting a '1'
-- Ken Petri [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 08:05 AM -0700): Alessandro Camilli wrote: Ken Petri wrote: When I use any capturestart/captureend for rendering out content panes, accordion panes, etc., There is a '1' inserted into the div for the widget. Is there a way to suppress this? Thanks! Try to remove the '=' in the first tag of php code. before: ?= code ? ?= code... ? After: ? code...? ?= code ...? Thanks Alessandro. I went through the application and removed the = from all captureStart lines of code. This has fixed the problem. With the standalone helpers--ones where I'm not using captureStart/End but just declaring the helper as a single enclosed chunk of code--the = needs to stay in. Can you or anyone explain why this fix is necessary? I noticed it is necessary whether you use the short_php_tags syntax or use an echo. Actually, it shouldn't be an issue -- but looking at the code, I'm returning the return of ob_start() -- which is a boolean (in this case, 1), and when cast to a string emits a value. I've created an issue in the tracker for this: http://framework.zend.com/issues/browse/ZF-4522 and you should see it come through svn shortly. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Unable to programatically create filteringSelect
Nico Edtinger wrote: Sudheer wrote: var counter = 0; function moreWidgets() { counter++; var stateSelect = new Array(); list = stateSelect[counter]; var filteringSelect = new dijit.form.FilteringSelect( { id: stateSelect[counter], name: productId[ + counter + ], searchAttr: productName }, list); newStore = new dojo.data.ItemFileReadStore({url: '/product/jsonlist'}); filteringSelect.store = newStore; [...] When the function moreWidgets() is called, it is unable to create the filteringSelect widget. If I comment out the lines that create and append filteringSelect, the function works well. It also creates the other price and quantity elements when the filteringSelect lines are commented. But the script halts when the filteringSelect lines are uncommented. I get the message root is null si = root.selectedIndex; file /js/dojo...mboBox.js (line 1051) in firebug console. I would have asked the question in the dojo forums. But anyway ... here is a guess. Thanks for the response. Few kind folks helped me on #dojo for couple of hours. Unfortunately. we were unable to resolve the issue. I have an example HTML page where the same moreWidgets() function works well. I only get this issue when trying to integrate into the application that uses Zend Framework. Line 1051 in ComboBox.js is dijit.form._ComboBoxDataStore.fetchSelectedItem(). That's the store, which uses a select node instead of a normal store. So I think you should first create the store and give that as a param to the constructor of dijit.form.FilteringSelect. Few folks on #dojo also suspected this to be cause. But it is not. Like I said above, I have a clean working example which generates input element with filteringSelect widget before the store is created. BTW in firebug you can normally check which line of your code causes the error, with the backtrace and the function parameters in the trace. Or you set breakpoint, add watches and step through the code to see what goes wrong. In the firebug console I get TypeError: root is undefined error when I execute the following JavaScript line var product = new dijit.form.FilteringSelect(); However, I can execute the same line in the firebug console when the working example page is loaded. It returns an object and does not show any error. I suspect, the issue lies somewhere in ZF and Dojo integration. Of course, I could be wrong. You can reproduce this behaviour by doing the following steps: 1. Create a Zend_Form object with couple of sample elements. 2. Use dojo() view helper to specify path and stylesheet themes to use 3. Write a JavaScript function that creates an element with filteringSelect widget and include it in your view/layout. 4. Call the JavaScript function that you wrote in step 3. One more fact I have observed is, this is happening with only the filteringSelect dijit. Regards, -- Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011 URL : www.binaryvibes.co.in Phone: +91 80 41558451 * Mobile: +91 99005 07499 Community : http://lampcomputing.com
Re: [fw-general] Dojo capturestart/end inserting a '1'
-- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 01:55 PM -0400): -- Ken Petri [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 08:05 AM -0700): Alessandro Camilli wrote: Ken Petri wrote: When I use any capturestart/captureend for rendering out content panes, accordion panes, etc., There is a '1' inserted into the div for the widget. Is there a way to suppress this? Thanks! Try to remove the '=' in the first tag of php code. before: ?= code ? ?= code... ? After: ? code...? ?= code ...? Thanks Alessandro. I went through the application and removed the = from all captureStart lines of code. This has fixed the problem. With the standalone helpers--ones where I'm not using captureStart/End but just declaring the helper as a single enclosed chunk of code--the = needs to stay in. Can you or anyone explain why this fix is necessary? I noticed it is necessary whether you use the short_php_tags syntax or use an echo. Actually, it shouldn't be an issue -- but looking at the code, I'm returning the return of ob_start() -- which is a boolean (in this case, 1), and when cast to a string emits a value. I've created an issue in the tracker for this: http://framework.zend.com/issues/browse/ZF-4522 and you should see it come through svn shortly. Fixed in trunk and 1.6 release branch -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
[fw-general] Re: Create issue issue. . .
Wil Sinclair wrote: Hi all, I ran a few scripts on the JIRA instance to make sure everyone is in the right groups. Could the people who were having trouble seeing the 'create issue' link check whether they are still having problems and get back to me at [EMAIL PROTECTED] Yay, I can comment :) Thanks Wil Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Zend_File_Transfer addFilter('Rename', ...
My file is uploading, and being error checked, but it's not being renamed but I can't figure out why: $upload = new Zend_File_Transfer_Adapter_Http(); $upload-addValidator('FilesSize', array('3kB', '4MB')); $upload-addValidator('Extension', array('gif', 'jpg')); $upload-setDestination('/var/www/gefanuc/web/files'); $upload-addFilter('Rename', '/var/www/gefanuc/web/files/newname.jpg', 1); if (!$upload-receive()) { $messages = $upload-getMessages(); echo implode(\n, $messages); } when I print out the $upload array I can see that my filter is set up right, but my file never gets renamed. What an I missing -- View this message in context: http://www.nabble.com/Zend_File_Transfer-addFilter%28%27Rename%27%2C-...-tp19886634p19886634.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_File_Transfer addFilter('Rename', ...
How about switching on exceptions ?? Your validators do not work... missing an parameter. Also your filter will not work... missing parameter. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: summertime [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Wednesday, October 08, 2008 10:11 PM Subject: [fw-general] Zend_File_Transfer addFilter('Rename', ... My file is uploading, and being error checked, but it's not being renamed but I can't figure out why: $upload = new Zend_File_Transfer_Adapter_Http(); $upload-addValidator('FilesSize', array('3kB', '4MB')); $upload-addValidator('Extension', array('gif', 'jpg')); $upload-setDestination('/var/www/gefanuc/web/files'); $upload-addFilter('Rename', '/var/www/gefanuc/web/files/newname.jpg', 1); if (!$upload-receive()) { $messages = $upload-getMessages(); echo implode(\n, $messages); } when I print out the $upload array I can see that my filter is set up right, but my file never gets renamed. What an I missing -- View this message in context: http://www.nabble.com/Zend_File_Transfer-addFilter%28%27Rename%27%2C-...-tp19886634p19886634.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Strange behaviour of IndexController in module default with current trunk
Hello everyone, since a week I get the follwing error when I'm trying to use the current trunk: exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name Translate was not found in the registry; paths searched: array ( 'Zend_Dojo_View_Helper_' = array ( 0 = 'Zend/Dojo/View/Helper/', ), 'Zend_View_Helper_' = array ( 0 = 'Zend/View/Helper/', 1 = './views\\helpers/', 2 = 'D:/xampp/htdocs/workspace/application/modules/default/views\\helpers/', ), ) All other modules and and controllers just work fine, except for the indexController in the module default. Can anyone tell me what has changed? By the way, I'm currently using ZF 1.6 again and it just works... Thanks. -- View this message in context: http://www.nabble.com/Strange-behaviour-of-IndexController-in-module-%22default%22-with-current-trunk-tp19889177p19889177.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_File_Transfer addFilter('Rename', ...
exceptions are on... and the validators do work ( see attached screen capture of error when I try to upload a pdf) I got : $upload-addFilter('Rename', '/var/www/gefanuc/web/files/newname.jpg', 1); from http://www.thomasweidner.com/flatpress/2008/09/07/destination-and-renaming-of-uploaded-files/ here . If I am missing a parameter, can you give me a hint as to what it is? If this is the wrong place to ask for help of this kind can you tell me where I should place these posts? -- View this message in context: http://www.nabble.com/Zend_File_Transfer-addFilter%28%27Rename%27%2C-...-tp19886634p19889346.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_File_Transfer addFilter('Rename', ...
Well... I may be blind, but looking at the manual and also at my blog I see 3 parameters. Source, Target and Overwrite. http://framework.zend.com/manual/en/zend.file.transfer.filters.html#zend.file.transfer.filters.rename As your second parameter is no boolean he is used as target. Which means all your source files are renamed to 1... I dont really expect that this works... Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: summertime [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Thursday, October 09, 2008 1:07 AM Subject: Re: [fw-general] Zend_File_Transfer addFilter('Rename', ... exceptions are on... and the validators do work ( see attached screen capture of error when I try to upload a pdf) I got : $upload-addFilter('Rename', '/var/www/gefanuc/web/files/newname.jpg', 1); from http://www.thomasweidner.com/flatpress/2008/09/07/destination-and-renaming-of-uploaded-files/ here . If I am missing a parameter, can you give me a hint as to what it is? If this is the wrong place to ask for help of this kind can you tell me where I should place these posts? -- View this message in context: http://www.nabble.com/Zend_File_Transfer-addFilter%28%27Rename%27%2C-...-tp19886634p19889346.html Sent from the Zend Framework mailing list archive at Nabble.com.