Re: [fw-general] Deploy an ZF2 app
We use Chef to deploy and manage all of our boxes from their git repos. On Thu, May 8, 2014 at 10:41 AM, Stefano Torresi wrote: > Jenkins or any other CI/CD system is the ideal solution, but it's arguably > a bit overkill for small teams, unless you really to show off devops like a > boss. > > With a little work you can setup a git server with bare repos and a > post-receive hook, to make deploy possible with a simple push to a specific > remote. > > There are services, like the mentioned DeployHQ, that basically provide > this functionality (with a lot of bells and whistles), for a price. > > In the absence of such options, I usually require an ssh access and just > use git & composer from cli. > > Using an FTP client manually is a but too old fashioned and I would not > consder it as a viable and reliable alternative, these days. > > Stefano Torresi > Web Developer > > > 2014-05-08 6:41 GMT+02:00 Ralf Eggert : > > > Hi, > > > > I wonder how all of you deploy your ZF2 applications to both staging and > > production servers. I used a couple of different approaches and have > > seen others in projects respectively: > > > > - Use Git and Composer for deployment > > - Use https://github.com/zfcampus/zf-deploy > > - Use Jenkins CI for deployment > > - Use good old FTP (extra tool or with IDE support) > > > > Which way do you prefer? Do you use other deployment strategies? Is > > there a standardized way to follow? > > > > I am looking forward for your thoughts and ideas. > > > > Thanks and best regards, > > > > Ralf > > > > -- > > List: fw-general@lists.zend.com > > Info: http://framework.zend.com/archives > > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > > > > > >
Re: [fw-general] ZF2: Access Service Manager from Mapper
For me it depends on two things: 1) What it *absolutely* required for the Class to be usable? Everything that must be there should be in the constructor, other things via set methods. 2) How long is the constructor? I'm generally not a fan of having a constructor with 10's of parameters. This usually comes about by not following point #1 But it comes down to personal preference :) Alex. On Thu, Aug 16, 2012 at 7:43 PM, Ralf Eggert wrote: > Hi again, > > another question came to my mind. Which way do you prefer. > > Using the constructor to pass objects: > > 'User\Mapper\User' => function($sm) { > $table = $sm->get('User\Table\User'); > $mapper = new UserMapper($table); > return $mapper; > }, > > Or using setter methods to pass objects > > 'User\Mapper\User' => function($sm) { > $table = $sm->get('User\Table\User'); > $mapper = new UserMapper(); > $mapper->setDbTable($table); > return $mapper; > }, > > Any comments? > > Regards, > > Ralf > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >
[fw-general] Subscribe Me
Thank you!
Fwd: [fw-general] Re: Looking for help for suffix .html and public/ folder out of the url
Forgot to click 'Reply all', forwarding my reply onto list. -- Forwarded message ------ From: Alex Major Date: Thu, Jul 7, 2011 at 11:59 PM Subject: Re: [fw-general] Re: Looking for help for suffix .html and public/ folder out of the url To: damdamien On Thu, Jul 7, 2011 at 8:06 PM, damdamien wrote: > it's ok for the public folder. > > but the .html URL suffix it's not done. > > I'm looking for doing it. > > I'm trying a lot of different thing but notthing want to work. > > no one have got an idea please. > > damdamien > > You would do this through Apache (or whichever web server your using). You should set up a vhost file which points to the public/ directory and has re-write conditions for handling (or in actual fact, ignoring) .html suffixes. Alex
Re: [fw-general] Several form on one page
On Wed, Jul 6, 2011 at 6:32 PM, Echol wrote: > > How to implement pageAction to that he output three of these forms and in > the validation of any of them and if it is not valid then also Display some > two forms? > > Hey Echol, I don't really understand the use case here, or at least what your trying to achieve. >From what I gather, all of the forms are related to a specific task? For example editing a user? A good way of handling things like this can be with display groups and hiding fields. In your case you could attach all of the 9 elements to one form, and then split the form into three display groups. You can then use the removeElement() or set the display group visibility to zero, depending on the desired page. An example could be a user editing form. I have two forms, an Administration form for editing a user, and a User form to allow a user to edit themselves. The Administration version of the form contains fields like 'GroupID' , ' UserUniqueID' . However I don't want the user to be able to change their UserUniqueID or GroupID. Therefore I create an AdministerEditUser form and a UserEditUser form. The AdministerEditUser form contains all the elements in the init() function, the UserEditUser form extends the AdministerEditUser form, calls the parent constructor but calls the removeElement() function on the UserUniqueID and GroupID elements. The benefit of this direction is that you don't have to worry about declaring filters/validators in both forms. If you change the validator around a username then remembering where all of the validator declarations are can be a pain. Alex.
Re: [fw-general] Where does this code belong
Hi, When I find myself checking permissions and manipulating models I've always moved the code to a service layer. If the form with the controls is a User Administration form, then I would have the controller extract the pertinent request data and pass it to the UserManagement Service. The UserManagement service would validate the request data, fetch the model, authorize the User to perform the action and then return a constant. As an example for the return values based on the code you gave: UserManagement::SUCCESS UserManagement::FAILURE_PERMISSION_DENIED UserManagement::FAILURE_PERMISSION_UNKNOWN UserManagement::FAILURE (generic) The controller can then have a switch statement which runs through the possible return values from User Management. I prefer putting the logic into a service layer as I often find that: 1) There tend to be very common actions throughout a system, and I hate code duplication between controllers. 2) Most of the sites I work on have several different access points to Controllers (e.g REST/JSON servers), so having a service avoids repetition between server types. If your unfamiliar with Service layers then having a google around would be a wise 30 minutes spent. Matthew has blogged about services within Zend a few times and there are many good resources around. A quick example of how a service layer sits within an application can be found here: http://www.angryobjects.com/wp-content/uploads/2009/03/diagram11.png If your preference is for a Controller/Model only setup, then I would deffinately keep _that_ code in the Controller. I believe in the fat model thin controller theory, but you shouldn't make your Models depend on the Controllers. Alex. On Mon, Jun 6, 2011 at 5:31 AM, Peter Sharp wrote: > I'm hitting my usual problem of getting something working and then > wondering > if I've done things the right way and put things in the right place. > > I'm just wondering how skinny a controller should be, as in 'skinny > controller, fat model'. > > As an example, I have a table listing database rows with a form per row > with > some controls (move up, move down, delete). These are submitted to > processAction(), which looks something like this. > > public function processAction() >{ >$request = $this->getRequest(); >if($request->isPost()) { >$post = $request->getPost(); > >// Specify rows with target ids >$id_keys = array('row_id', 'up_id', 'down_id'); >foreach($post as $key=>$value) { >if (in_array($key, $id_keys)) $toTest[] = $value; >} > >// Verify all specified ids are OK to use >$mapper = new Vendor_Model_Mapper_Size(); >$keyTest = $mapper->hasPermission($toTest, $this->vendor); > >if ($keyTest) { >// SUCCESS - Permission Granted >if(isset($post['promote_x'])) { >if (isset($post['row_id']) && isset($post['up_id'])) { >if (!$mapper->swapSortOrder($post['row_id'], > $post['up_id'])) { >// FAILURE - Unknown Error >$this->_helper->FlashMessenger('Process Failure > - Unknown Error.'); >} >} else { >// FAILURE >$this->_helper->FlashMessenger('Process Failure - > Malformed Request.'); >} >} >if(isset($post['demote_x'])) { >if (isset($post['row_id']) && isset($post['down_id'])) { >if (!$mapper->swapSortOrder($post['row_id'], > $post['down_id'])) { >// FAILURE >$this->_helper->FlashMessenger('Process Failure > - Unknown Error.'); >} >} else { >// FAILURE >$this->_helper->FlashMessenger('Process Failure - > Malformed Request.'); >} >} >if(isset($post['delete_x']) && isset($post['row_id'])) { >if ($mapper->deactivate($post['row_id'])) { >// SUCCESS - Deactivated >$this->_helper->FlashMessenger('Deleted.'); >} else { >// FAILURE - Unknown Error >$this->_helper->FlashMesseng
[fw-general] how does Zend_Form validation handle undefined attributes?
What does Zend_Form::isValid() do with posted parameters that have no matching attribute? Does it just ignore them? I.e., if I post valid values for all required fields, plus some extra parameters that the form has no matching attribute for, will isValid() pass? Thanks, -- Alex Howansky smime.p7s Description: S/MIME Cryptographic Signature
Re: [fw-general] Re: Zend Framework 1.10.x and namespaces
Remove this (you shouldn't need it and it is a waste of cycles): $autoloader->setFallbackAutoloader(true); If you're using namespaces and your code instantiates objects from strings, like this: $class = '\\My\\Thing'; $obj = new $class(); Then you'll need to call setFallbackAutoloader() in order to work around PHP bug 50731. Alternatively, you can also do this: $autoloader->registerNamespace('My'); $autoloader->registerNamespace('\\My'); I think this bug has been fixed for the next release, so hopefully this technique will become unnecessary. -- Alex
Re: [fw-general] Looking to conditionally override router from bootstrap
This sounds like a good use for a controller plugin. Instead of adding a new route, you can simply modify the request: Hmm, unfortunately my conditional is dependent on some of the other initialization logic in the bootstrap. So, in order to use this technique, I'd have to pass those dependencies to the plugin constructor for temporary storage there, which seems rather roundabout as well. Perhaps a combination of the two methods would work better. I could write a generically useful "goto" plugin that simply takes a controller/action to always override the current request with: class App_Controller_Plugin_Override extends Zend_Controller_Plugin_Abstract { protected $_action = null; protected $_controller = null; public function __construct($controller, $action) { $this->_controller = $controller; $this->_action = $action; } public function dispatchLoopStartup($request) { $request->setControllerName($this->_controller); $request->setActionName($this->_action); } } And then keep my conditional in the bootstrap, and only register the plugin when it fires: if () { $front->registerPlugin( new App_Controller_Plugin_Override('my_con', 'my_act') ); }
[fw-general] Looking to conditionally override router from bootstrap
I want to add a conditional to my bootstrap that, if some check is true, sends all traffic, regardless of the request, to a specific controller/action. Right now, I'm overriding all the previously defined routers with a wildcard that catches everything: public function _initSite() { if () { $override = new Zend_Controller_Router_Route( '*', array('controller' => 'my_con', 'action' => 'my_act') ); $this->getResource('FrontController') ->getRouter() ->addRoute('override', $override); } } This seems a rather roundabout way of doing it. Am I missing something more obvious? Thanks,
Re: [fw-general] throwing exceptions in bootstrap
Override _bootstrap(), wrap it in try-catch, catch the exception, register an early plugin that rethrows that exception. See this gist for an example --> http://gist.github.com/298848 . You might want to add another try-catch outside the bootstrap for when the FrontController resource itself throws an exception. Perfect, thanks.
[fw-general] throwing exceptions in bootstrap
How do I catch an exception that gets thrown in one of my bootstrap's _init methods? I'd like to handle it via my standard error handler in the error/error action but it seems that's not possible since the exception fires before the request gets dispatched.
Re: [fw-general] sending mail to multiple recipients & return code for bad addresses
1.) Is the best way of sending a single email to every subscriber to add their address to the BCC list? Are there any foreseeable problems if the list gets too big? I wouldn't recommend this technique unless you have only a handful of recipients, as many email servers impose a hard cap on the number of recipients per message. (I believe Gmail has a 100 recipient cap, if I'm not mistaken.) 2). Is there some sort of return code for addresses that are non-existent? No. Zend_Mail simply hands the message off to your mail server's queue. What happens after that (i.e., delivery attempts, failures, etc.) is encapsulated within your mail server's internal environment and is not directly accessible to PHP. If your goal is to detect bounces, I'd recommend using the "unique address per recipient as a return-path" method. E.g., set your return path to 'bounce-12...@yourdomain.com' where 12345 is some unique identifier for the recipient. Then you can monitor the messages that come into the bounce inbox, decode the address back into your unique id, and set your software to disable the appropriate recipient. -- Alex Howansky
Re: [fw-general] Zend_Session Garbage Collections Works?
Hi Benjamin, About my previous post: > I setup a .php file that runs by bootstrap then outputs phpinfo() and > everything looks right. Still, the GC is not running. I did that on my dev machine. On production (yep Benjamin, debian), gc_probability was set to 0. I have many apps on the server so they have their own session folders (different gc_maxlifetime). All is well now, set gc_probability to 1. ( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501313) Sorry to bug the mailing list with this! - Alex On Mon, Aug 10, 2009 at 4:08 PM, Benjamin Eberlei wrote: > are you running on debian? it disables the php session gc and uses its own > cronjob to cleanup, which sometimes is not running correctly.. > > On Monday 10 August 2009 09:05:46 pm Alex wrote: > > Any idea why the GC isn't running? > > > > I setup a .php file that runs by bootstrap then outputs phpinfo() and > > everything looks right. Still, the GC is not running. > > > > - Alex > > > > On Mon, Aug 10, 2009 at 3:58 PM, Peter Warnock >wrote: > > > On Mon, Aug 10, 2009 at 11:20 AM, Alex wrote: > > >> As an aside: would using the DbTable save handler be more efficient > than > > >> the file handler? > > >> > > >> - Alex > > > > > > The file handler is faster, but the db handler can provide persistence > > > across multiple servers and is potentially more secure depending on the > > > hosting environment. - pw > > > -- > Benjamin Eberlei > http://www.beberlei.de >
Re: [fw-general] Zend_Session Garbage Collections Works?
Any idea why the GC isn't running? I setup a .php file that runs by bootstrap then outputs phpinfo() and everything looks right. Still, the GC is not running. - Alex On Mon, Aug 10, 2009 at 3:58 PM, Peter Warnock wrote: > On Mon, Aug 10, 2009 at 11:20 AM, Alex wrote: > >> >> As an aside: would using the DbTable save handler be more efficient than >> the file handler? >> >> - Alex >> > > The file handler is faster, but the db handler can provide persistence > across multiple servers and is potentially more secure depending on the > hosting environment. - pw >
[fw-general] Zend_Session Garbage Collections Works?
Hello, I've set the gc_maxlifetime to 14 days, but PHP's session GC is simply not running. My sessions dir now has hundreds of thousands of files. What am I doing wrong? Below is my session initialization: $config = Zend_Registry::get('config'); $options = array( 'name' => 'app_sid', 'gc_maxlifetime' => 14 * 86400, 'cookie_lifetime' => 14 * 86400, 'cookie_domain' => $config->session->cookieDomain, 'save_path' => '/var/somedir/sessions' ); Zend_Session::start($options); As an aside: would using the DbTable save handler be more efficient than the file handler? - Alex
[fw-general] Zend Gdata Calendar, event feed for specific calendar
Hello, Is there a way to have $service->newEventQuery() look for events within a specific calendar, not necessarily the user default? Thanks! - Alex
Re: [fw-general] Zend_Service_Twitter in action
I had a look at Zend_File but lighttpd doesn't play nice with the required extensions. So I ended up using a flash-based solution called FancyUpload. SWFupload is pretty nice as well. - Alex > On Thu, Jul 16, 2009 at 3:59 PM, Саша Стаменковић wrote: > >> Yes, Zend_Service_Twitter is great, but still doesn't implement full >> twitter api. Cool aite, what did you use for upload progress? >> >> Regards, >> Saša Stamenković >> >> >> >> On Thu, Jul 16, 2009 at 8:29 PM, Alex wrote: >> >>> Just wanted to thank the Zend community for yet another great component. >>> >>> It only took about a day to integrate Twitter into our site >>> http://sharesend.com using Zend_Service_Twitter. >>> >>> If anybody needs some tips feel free to send me an email. >>> >>> - Alex >>> >> >> >
[fw-general] Zend_Service_Twitter in action
Just wanted to thank the Zend community for yet another great component. It only took about a day to integrate Twitter into our site http://sharesend.com using Zend_Service_Twitter. If anybody needs some tips feel free to send me an email. - Alex
[fw-general] Session Lifetime
Does the Zend Session save handler file permit sessions to have different lifetimes? - alex (from mobile)
Re: [fw-general] jotBug is iPhone/Touch friendly
I assume this uses the User-Agent string to determine which front end to render? THat is correct :-) Looks great but doesn't work on my G1. :( I guess I will submit a patch to iui, to have it recognize the slightly different user-agent string for what is basically the same browser. Thanks, -- Alex Howansky smime.p7s Description: S/MIME Cryptographic Signature
Re: [fw-general] jotBug is iPhone/Touch friendly
With thanks to Phil and the iUI project - http://code.google.com/p/iui/ jotBug now has a iPhone/Touch web frontend :-) Test it for yourself @http://jotbug.org from your iPhone/Touch :-) I assume this uses the User-Agent string to determine which front end to render? -- Alex Howansky smime.p7s Description: S/MIME Cryptographic Signature
Re: [fw-general] Zend View vs. Smarty
A lot have been discussed, but anyway it is still difficult to decide. A project is to be developed, and more persons will have to work at it. Those persons will have some experience in ZF and probably also in Smarty. The problem is: what are the advantages and disadvantages of using ZF Template Engine vs. Smarty. How much of you use Smarty? Why do you prefer Smart/Zend_View? I think the greatest advantage to using a non-PHP templating engine in your view layer is that you can force logical isolation between your designers and your programmers. This is especially important if you have untrusted or external designers providing input for your product. I.e., you do not want your designers to be able to do things like this in a view template: query('drop table ... '); ?> Cheers, Alex smime.p7s Description: S/MIME Cryptographic Signature
Re: [fw-general] Re: Handling timezones?
Hi Thomas, > > Right, I understand UTC dates are UTC. > > My question is how to convert to the user's timezone application wide. How > does Zend Date know the date I'm giving it for creation is UTC and that the > date I want output is in the user's timezone? > > - Alex > > > > On Thu, Mar 12, 2009 at 2:49 PM, Thomas Weidner wrote: > >> You can't display UTC dates with local time. >> >> UTC is per definition without any timezone. >> Local dates/times are per definition with a timezone. >> >> This is why the time does also change when you set another timezone. >> f.e. 10:00 UTC == 12:00 GMT+2 >> >> Greetings >> Thomas Weidner, I18N Team Leader, Zend Framework >> http://www.thomasweidner.com >> >> - Original Message - From: "A.J. Brown" >> To: "Alex" >> Cc: >> Sent: Thursday, March 12, 2009 6:37 PM >> Subject: Re: [fw-general] Re: Handling timezones? >> >> >> >> First, you'll want to make sure MySQL and your applications are using the >>> same timezone. MySQL doesn't store the timezone, so it doesn't care in >>> regards to dates being passed in, but you'll run into consitency problems >>> if >>> you use MySQL date functions in combination. >>> >>> The documentation is unclear on how to display UTC dates as locale times >>> (within proper timezone), but it does state that Zend_Date works >>> independently of the internal php timezone. I would try reading the date >>> from the database into a Zend_Date object, then setting the timezone to >>> the >>> user's timezone before returning the date. >>> >>> Let us know how that works out. >>> >>> >>> On Thu, Mar 12, 2009 at 10:12 AM, Alex wrote: >>> >>> Anyone? >>>> >>>> - Alex >>>> >>>> >>>> >>>> On Wed, Mar 11, 2009 at 12:50 PM, Alex wrote: >>>> >>>> Hello, >>>>> >>>>> What's the recommended strategy for handling timezones with Zend_Date? >>>>> I >>>>> use the datetime in mysql to store dates. >>>>> >>>>> What's the right combination of date_default_timezone_set and Zend_date >>>>> so >>>>> that everything is always stored in UTC and the user always sees dates >>>>> in >>>>> his local time? >>>>> >>>>> - Alex >>>>> >>>> >>>> >>>> >>>> >>> >>> -- >>> A.J. Brown >>> web | http://ajbrown.org >>> phone | (937) 660-3969 >>> >>> >> >
[fw-general] Re: Handling timezones?
Anyone? - Alex On Wed, Mar 11, 2009 at 12:50 PM, Alex wrote: > Hello, > > What's the recommended strategy for handling timezones with Zend_Date? I > use the datetime in mysql to store dates. > > What's the right combination of date_default_timezone_set and Zend_date so > that everything is always stored in UTC and the user always sees dates in > his local time? > > - Alex
[fw-general] Handling timezones?
Hello, What's the recommended strategy for handling timezones with Zend_Date? I use the datetime in mysql to store dates. What's the right combination of date_default_timezone_set and Zend_date so that everything is always stored in UTC and the user always sees dates in his local time? - Alex
Re: [fw-general] Simple filter idea
I've seen a couple of functions in the WordPress source that do just that. Maybe borrow from them and implement it as a Zend filter? - Alex On Thu, Mar 5, 2009 at 11:04 AM, Alex wrote: > I've seen a couple of functions in the WordPress source that do just that. > Maybe borrow from them and implement it as a Zend filter? > > - Alex > > > > On Thu, Mar 5, 2009 at 10:58 AM, vadim gavrilov wrote: > >> You can do that yourself. I mean even using trim will trim out the leading >> and trialing spaces. >> >> >> On Thu, Mar 5, 2009 at 3:56 PM, Baptiste Placé < >> baptiste.pl...@utopiaweb.fr> wrote: >> >>> Hello, >>> >>> I have a simple idea for a filter proposal : >>> Break words of a text that are too long by adding space characters. This >>> can be usefull when creating comment form and avoid the annoying guy who >>> just want to make the html layout go crazy. >>> >>> One other thing that may be usefull is replacing 3 or more consecutive >>> new lines by one or two - or whatever character. >>> >>> Hope this is clear enough :) >>> Does this deserve a proposal ? The code is quite small. >>> >>> Baptiste >>> >> >> >> >> -- >> Vincent Gabriel. >> Lead Developer, Senior Support. >> Zend Certified Engineer. >> >> >> >> >> >
Re: [fw-general] how to determine if a column exists in a table (not a row)
I believe that something along the lines of: in_array($colName, $this->info('cols') Will get you exactly what you're looking for. Yes, perfecto. Thanks, -- Alex Howansky Director of IT Birdview Technologies smime.p7s Description: S/MIME Cryptographic Signature
[fw-general] how to determine if a column exists in a table (not a row)
If I have an instance of a Zend_Db_Table_Row object, I can determine if a certain column exists in that row by way of the __isset() method, like this: if (isset($row->$col)) { ... } I'd like to be able to do this same sort of test, but on an instance of a Zend_Db_Table object instead. I don't see any built in mechanism to support this however. I thought I'd ask if I was missing something before extending Zend_Db_Table. Thanks, -- Alex Howansky Director of IT Birdview Technologies smime.p7s Description: S/MIME Cryptographic Signature
Re: [fw-general] Securely passing params between actions
Any other solution? How about something like $this->_setInternalParam() and $this->_getInternalParam() Would that be hard to implement? > > On Thu, Feb 19, 2009 at 12:07 PM, Ben Scholzen 'DASPRiD' > wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Disable the default route, and only use custom routes. >> ... >> : ___ _ ___ ___ ___ _ ___: >> : | \ /_\ / __| _ \ _ (_) \ : >> : | |) / _ \\__ \ _/ / | |) | : >> : |___/_/:\_\___/_| |_|_\_|___/ : >> ::: >> : Web: http://www.dasprids.de : >> : E-mail : m...@dasprids.de : >> : Jabber : jab...@dasprids.de : >> : ICQ: 105677955 : >> ::: >> >> >> Alex schrieb: >> > Hi Ben, >> > >> > Well, $this->_setParam() almost suits me perfectly. Here's the problem. >> > >> > Action1: >> > _setParam('secret', 'somevalue') >> > _forward('action2) >> > >> > Action2: >> > _getParam('secret') >> > >> > But how do I make it so that 'secret' cannot be a usersupplied >> parameter? >> > >> > - Alex >> > >> > >> > On Thu, Feb 19, 2009 at 10:02 AM, Ben Scholzen 'DASPRiD' >> > mailto:m...@dasprids.de>> wrote: >> > >> > That really depends. The easiest thing would be to store the value in a >> > session, and if required give the user an hashed identifier as parameter >> > to identify the data. If the data should be long-term persistent or for >> > multiple users, store the data in a database. >> > ... >> > : ___ _ ___ ___ ___ _ ___: >> > : | \ /_\ / __| _ \ _ (_) \ : >> > : | |) / _ \\__ \ _/ / | |) | : >> > : |___/_/:\_\___/_| |_|_\_|___/ : >> > ::: >> > : Web: http://www.dasprids.de : >> > : E-mail : m...@dasprids.de <mailto:m...@dasprids.de> : >> > : Jabber : jab...@dasprids.de <mailto:jab...@dasprids.de> : >> > : ICQ: 105677955 : >> > ::: >> > >> > >> > Alex schrieb: >> >> How can I pass a parameter between two actions, but making it so the >> >> second action cannot receive said parameter directly from the user? >> > >> >> - alex (from iphone) >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.9 (GNU/Linux) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >> >> iEYEARECAAYFAkmddaAACgkQ0HfT5Ws789BcDQCgw3bR3Y6igcjNOjF/+Ez8KxyA >> 5j8AoNLINOw+tKAH01MZddSW+tZzuWla >> =JxBh >> -END PGP SIGNATURE- >> > >
[fw-general] Securely passing params between actions
How can I pass a parameter between two actions, but making it so the second action cannot receive said parameter directly from the user? - alex (from iphone)
Re: [fw-general] Seeking input on naming convention
Let's say I name this class ABC_Spec. Whoops, typo -- meant to say NS_Spec. -- Alex Howansky Director of IT Birdview Technologies smime.p7s Description: S/MIME Cryptographic Signature
[fw-general] Seeking input on naming convention
Let's say that I'm developing some extensions to ZF and I'm adopting the documented coding standards. I'll use a namespace of NS, so my classes will all be named NS_*. I'll be creating a class that implements an existing and well-defined specification. Let's say I name this class ABC_Spec. There are multiple versions of this specification in use, let's call them revision 1.0, revision 2.0, and revision 2.5. I want to be able to use the same interface regardless of which revision I need, so I'll create one subclass of ABC_Spec for each revision. The question is, if these already-established revision identifiers are numerical in nature, but the ZF standards frown upon numerical names, what's the best naming scheme for my subclasses? This seems just wrong: class NS_Spec_10 extends NS_Spec { } class NS_Spec_20 extends NS_Spec { } class NS_Spec_25 extends NS_Spec { } This seems rather vague: class NS_Spec_R10 extends NS_Spec { } class NS_Spec_R20 extends NS_Spec { } class NS_Spec_R25 extends NS_Spec { } This seems best: class NS_Spec_Revision10 extends NS_Spec { } class NS_Spec_Revision20 extends NS_Spec { } class NS_Spec_Revision25 extends NS_Spec { } This seems a bit much: class NS_Spec_OnePointZero extends NS_Spec { } class NS_Spec_TwoPointZero extends NS_Spec { } class NS_Spec_TwoPointFive extends NS_Spec { } I don't see any examples in the current ZF code to compare against. How would you do it? Thanks, -- Alex Howansky Director of IT Birdview Technologies smime.p7s Description: S/MIME Cryptographic Signature
[fw-general] Producing Google Base atom feeds
Hi, I'm currently trying to figure out the best way to produce a Google Base Atom feed (which should not be sent to Google directly but delivered by our platform). * My first guess was to use the Zend_Gdata_Gbase component. But as I figured out, this component is currently meant to read feeds and to send single entries to Google. I managed to get the feed for a single element by calling $service->prepareRequest('', null, null, $myGbaseEntry), but I found no apparent way to assemble a whole feed containing several entries (I don't want to connect to google directly at all...) * My second try was to assemble the feed myself by using Zend_Feed with a builder: $feed = Zend_Feed::importBuilder($builder, 'atom'); So I wrote a class extending the Zend_Feed_Builder_Interface, but this did not work either, because the mapping function ignores all custom namespaces, producing only atom feeds with default attributes * So I guess I'm up to assemble my feed "low level" by using Zend_Feed directly, which is also not so easy as I thought, since the only documentation about producing feeds with this component is http://framework.zend.com/manual/en/zend.feed.modifying-feed.html This tells me how to create a new Entry-Object, but not how to append this to my feed. I'd expect an "append"-method for Zend_Feed_Atom, but it has only a __set function. And this piece of code here doesn't work at all: Zend_Feed::registerNamespace('g', 'http://base.google.com/ns/1.0'); $feed = new Zend_Feed_Atom(null, ''); //It needs 'something' for the constructor $entry1 = new Zend_Feed_Entry_Atom(); $entry1->title = 'entry1'; $entry1->{'g:id'} = 1; $entry2 = new Zend_Feed_Entry_Atom(); $entry2->title = 'entry2'; $entry2->{'g:id'} = 2; $feed->entry = array($entry1, $entry2); echo($feed->saveXML()); So I guess I'm up to assemble it "really low level" using DOMDocument? (I noticed that the Gdata component doesn't use Zend_Feed either, but the php DOM classes instead). Or am I missing something here? Thanks, Alex -- View this message in context: http://www.nabble.com/Producing-Google-Base-atom-feeds-tp20488222p20488222.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Commit 11606 seems to have broken Zend_Translate
Hello, Commit 11606 by "thomas" seems to have broken something Translate related. After the update, $this->translate()->getLocale() causes a total halt in execution, with no Exceptions thrown. Reverting to 11600 fixes the problem. Anyone else experiencing this? - Alex
Re: [fw-general] Adding extra fields to a Zend_Form
Jason Webster wrote: > > There is a standard Element Class for hidden form fields. > <http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.hidden> > This isn't a hidden field at all, just some output that I'd like displayed in the middle of the form, sorry! - Regards, Alex -- View this message in context: http://www.nabble.com/Adding-extra-fields-to-a-Zend_Form-tp18774058p18778140.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Adding extra fields to a Zend_Form
Alex Buell wrote: > > Yeah, but I'm doing this by adding elements to the Zend_Form which I've > designed. There has to be a way to add an element like the above! > On further thoughts, perhaps I haven't explained my problem properly. See, here's my code: $newResellerForm = new Zend_Form($newResellerFormArray); $resellerSql = "SELECT * FROM resellers ORDER BY name"; $resellerArray = $GLOBALS["db"]->fetchAll($resellerSql, $resellerArray["id"]); $resellersForm = new Zend_Form(); $resellersForm->setMethod("post"); $resellersSubForm = new Zend_Form_SubForm(); $items = 0; foreach ($resellerArray as $reseller) { $id = $row["id"]; $resellerRow = new Zend_Form_SubForm(); $resellerRow->addElement( "text", "name_{$items}", array( "size" => "40", "value" => $reseller["name"])); $resellerRow->addElement( "text", "notes_{$items}", array( "size" => "40", "value" => $reseller["notes"])); *** Here, I want to do echo $reseller["updated"] ***, but don't want this to be an input box or anything else *** $resellerRow->addElement( "checkbox", "active_{$items}", array( "value" => $reseller["active"])); $resellerRow->addElement( "checkbox", "delete_{$items}", array( "value" => "0")); $resellerRow->setElementDecorators(array( "ViewHelper", "Errors", array("HtmlTag", array("tag" => "td")), )); $resellersSubForm->addSubForm($resellerRow, $items); $items++; } - Regards, Alex -- View this message in context: http://www.nabble.com/Adding-extra-fields-to-a-Zend_Form-tp18774058p18777291.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Adding extra fields to a Zend_Form
Anton Mckee wrote: > > On Fri, Aug 1, 2008 at 2:26 PM, SexyAlexy <[EMAIL PROTECTED]> wrote: > > > content value=/> > > > Yeah, but I'm doing this by adding elements to the Zend_Form which I've designed. There has to be a way to add an element like the above! - Regards, Alex -- View this message in context: http://www.nabble.com/Adding-extra-fields-to-a-Zend_Form-tp18774058p18774430.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Implement Multi-protocol Login
Hello, I have my own registration system where users can create accounts, but I would also like to give them the option to use other types of logins, such as OpenID, Gmail, etc. What would be the best way to represent something like that in the database? Something like User table idtype type_id where type references an external table, and type_id the record within that table. so for my own login system it would be mylogintable id username password email for facebook maybe id fullname email for openid id uniqueurl etc... I would then use my User class to map data from the different protocols uniformely. Is there a better way to implement this? I know my discards foreign key checks, which is not ideal... - Alex
[fw-general] Zend Form Element Required
Hi, I want a form element requirement to be conditional. If a radio button is set to a certain value, the element is required. I created a ConditionalNotEmpty validator, but if the element is empty when submitted the validator is not executed... - alex (from iphone)
Re: [fw-general] Zend_Search_Lucene Best N Results
Hi Peter, Well, I opted instead for trying Sphinx full-text search. What took an hour to index with Zend_Search_Lucene takes around 5 seconds with Sphinx. Search is ridiculously fast with no optimization whatsoever. I'm getting document IDs from Sphinx (which gives really really good results) and running a MySQL IN() query to get fresh records. Very very nice. If you need any help setting this up let me know! You can test it at http://www.todascifras.com.br - Alex On Thu, Jun 19, 2008 at 3:19 PM, Pete Spicer <[EMAIL PROTECTED]> wrote: > Hello, > I've been having similar problems with ZSL as well, but whilst I haven't > found a quick solution, I've found that going back to the index itself and > understanding what is going on will prove useful - depending on what kinds > of documents you're indexing and what kinds of searches you're running, you > may find that is part of the problem. > > Without knowing the fields in your index, including the types of the > fields, and the types of words in your documents (or even what kinds of > documents you have), it's very hard to give any specific advice. > > The memory usage seems to come from the size of the word list itself, and > bear in mind that the word list will easily run into the thousands of unique > words. The way the default analyser handles it, things like "I'm" and > "There's" will be split at the apostrophe, so the index will be holding the > word 's' as a word. Things like this will easily expand the size of the > index, and massively increase the memory overhead. Additionally if you are > able to keep the input query small, with as few but more unique search terms > as possible, this will keep memory usage low. > > To really reduce memory, depending on whether you have the resources and > time to do so, it may be worth investigating writing a custom analyser, > geared towards the kinds of words you have in your database. In mine, for > example, I have multiple variant spellings of words on input - my index > holds written works, where the original author uses unusual constructions > (e.g. making s into sh to demonstrate that the character is drunk), so by > doing some analysis on that, I've been able to trim the index down and keep > its memory usage down. > > Another way is to avoid using Keyword fields where possible, and switching > them to some tokenised form, assuming the data can be suitably indexed and > isn't needed to be kept as Keyword. > > Stripping out really common words might also help, but that's only really > best if you're not using the indexed text to be able to display the results. > > If you are able to provide a few more details about your index, I might be > able to give you a few better pointers. > > Regards > Pete > > > > > Alex wrote: > >> Hi, >> >> I'm having serious memory problems with ZSL. My current index holds around >> 400 thousand documents. >> >> If I run a search for a term with about 500 results, ZSL returns the best >> results first but uses a tremendous amount of memory. >> >> If I use $index->setResultSetLimit(), I decrease memory usage >> significantly, but I get some very poor first results. >> >> Thanks for your help! >> >> >> - Alex >> > >
[fw-general] Zend_Search_Lucene Best N Results
Hi, I'm having serious memory problems with ZSL. My current index holds around 400 thousand documents. If I run a search for a term with about 500 results, ZSL returns the best results first but uses a tremendous amount of memory. If I use $index->setResultSetLimit(), I decrease memory usage significantly, but I get some very poor first results. Thanks for your help! - Alex
[fw-general] Locale in all URLs
Hello, I've implemented Zend_Translate but I would like to have unique urls for different locales. Currently I set locale via a cookie. I would like the current locale appended to all urls. domain.com/ redirects to domain.com/en, then all urls have domain.com/en/ as their base Same for all other locales. The idea is to have the search engines pickup localized versions for web pages. What would be the best way to implement this? Thanks! -- - Alex
Re: [fw-general] Zend Framework 1.0.3 released
Dmitry, I suspect that a few guys :-) here do not understand what you wrote. On Nov 30, 2007 6:09 PM, Dmitry Shaposhnik <[EMAIL PROTECTED]> wrote: > 45 минут назад появилось объявление на ZendDevZone: 45 minutes ago the announcement appears on ZendDevZone: > > I am pleased to announce the release of Zend Framework 1.0.3, now > available for download on the framework website. This mini-release > resolves 79 known issues and provides some additions > to functionality. > > Я уже обновился, вроде бы ничего не упало. I've updated, it's good so far. > > Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] FrontController improvement : preventing infinite dispatch loop
Hi, Normally, an application should not have infinite dispatch loops. They should be eliminated during development stage just like other bugs. So the developer need to know what cause these loops and change the application and this property is definitely not what can help much in that case. I think this should be solved by adding an optional controller plugin. It may log all forwards and throw en exception if there are to many of them. Sincerely, Alex On Nov 30, 2007 5:23 PM, Julien Pauli <[EMAIL PROTECTED]> wrote: > Hi everybody. > > I'm wondering why there is not actually any FrontController system to > prevent infinite dispatching loops. > Some of you massivelly use _forward or other tricks like that, but a loop > limitation should be set into FC as we all know that it is easy to get an > infinite dispatch() loop (specially while manipulating multiple plugins or > action helpers ). > > Why not set a private static property in FC called (for example) > maxDispatchLoopBeforeExit ? > This, with accessors (getter setter) and a default value to figure out (I > think 10 should be a reasonable average). > > In the dispatch loop, FC just increments an internal variable, and at the > end of the loop, checks its value with its static 'flag'. > > If over : it should then break the dispatch loop throwing (or response > appending) an exception ( ' infinite dispatch loop presumed' , something > like that ). > > Is that a good idea ? > Maybe someone has already thought about that ? > > cheers. > > Julien.Pauli > http://www.z-f.fr > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Zend_Feed error, possibly due to text encoding
Hello, Currently http://www.otago.ac.nz/its/notices/notices.xml contains some non-unicode characters so it cannot be parsed correctly. In any case, & should be escaped in XML documents using & entity. More details you can find in XML specification on http://w3.org. Sincerely, Alex On 10/24/07, justinyoung <[EMAIL PROTECTED]> wrote: > > I am getting an error when attempting to access an RSS feed using Zend_Feed. > > The error is as follows: > > 500 Internal Error > : exception 'Zend_Feed_Exception' with message 'DOMDocument cannot parse > XML: DOMDocument::loadXML() [function.DOMDocument-loadXML]: > xmlParseEntityRef: no name in Entity, line: 54' in > /Library/WebServer/Documents/framework/_library/Zend/Feed.php:204 Stack > trace: #0 > /Library/WebServer/Documents/framework/_library/Zend/Feed.php(180): > Zend_Feed::importString('_run('./application/v...') #4 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(742): > Zend_View_Abstract->render('itsfeed/index.p...') #5 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(763): > Zend_Controller_Action_Helper_ViewRenderer->renderScript('itsfeed/index.p...', > NULL) #6 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(810): > Zend_Controller_Action_Helper_ViewRenderer->render() #7 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Action/HelperBroker.php(160): > Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #8 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Action.php(504): > Zend_Controller_Action_HelperBroker->notifyPostDispatch() #9 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Dispatcher/Standard.php(237): > Zend_Controller_Action->dispatch('indexAction') #10 > /Library/WebServer/Documents/framework/_library/Zend/Controller/Front.php(911): > Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), > Object(Zend_Controller_Response_Http)) #11 > /Library/WebServer/Documents/framework/03/index.php(5): > Zend_Controller_Front->dispatch() #12 {main} module handeler > > My code is as follows: > > $content = "content:encoded"; > $blogfeed = > Zend_Feed::import('http://www.otago.ac.nz/its/notices/notices.xml'); > foreach ($blogfeed as $item) { > echo " \n "; > echo $item- link() . "> \n"; > echo $item->title() . " \n"; > } > > ?> > > I am not having problems with other feeds. I saved the xml file locally and > when I tried to open it in Textedit (OS X) I got the following error: > > The document "notices.xml" could not be opened. Text encoding Unicode > (UTF-8) is not applicable. > The file may have been saved using a different text encoding, or it may not > be a text file. > > I resaved the file using UTF-8 and saved the file to a local web server. > After some trial and error I traced the problem to this line in the xml > file: > > Blackboard Service Incidents & Course Statistics > > If I manually removed the ampersand so the line is: > > Blackboard Service Incidents Course Statistics > > I can successfully use the feed. Obviously not ideal as I have no control > over the original source feed. I am pretty new to this so I am probably > missing something simple. > -- > View this message in context: > http://www.nabble.com/Zend_Feed-error%2C-possibly-due-to-text-encoding-tf4680929s16154.html#a13375600 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] .Net or Zend Framework?
Ok. Sorry, guys. Usually I'm trying to avoid "one vs. another" discussions. I prefer to stop on "project requirements" point, which Bill highlighted below. I always glad to see you visiting my site and sending me emails. Sincerely, Alex On 10/8/07, Bill Karwin <[EMAIL PROTECTED]> wrote: > I agree with Rob. If your team and project have a significant > investment in .NET, then use .NET. If you're in the minority, and the > rest of the team are .NET advocates, then suck it up and learn .NET. > > The cost of re-tooling, re-training, and adjusting your team's culture > to the new language and framework is so expensive that it'll probably > cancel out any productivity advantage the other technology may have. An > organization should switch technologies only if there is some compelling > benefit, such as a required capability that the new language can do > easily, but which is grievous or simply impossible in the old language. > > One can make arguments about minor technical advantages PHP & ZF may > have over .NET. But I don't think there is any such point that could be > called "compelling" (except with respect to specific project goals). So > the non-technical arguments should be the deciding factors, such as > those regarding licences, cost, and team culture. > > Regards, > Bill Karwin > > > -Original Message- > > From: Rob Allen [mailto:[EMAIL PROTECTED] > > Sent: Sunday, October 07, 2007 2:20 AM > > To: fw-general@lists.zend.com > > Subject: Re: [fw-general] .Net or Zend Framework? > > > > rogeson wrote: > > > This is of course a no-brainer to me, but my current task is to > > > convince the company I work for to build our next product using the > > > Zend Framework instead of .Net, and there are a lot of .Net > > enthusiasts here. > > > > > > Does anybody have any good arguments as to how and why > > using PHP and > > > the Zend Framework is a superior choice to .Net? Has anybody had > > > convince their organization of the same sort of thing? > > > > > > > > For me, it would depend on the team. You can build great web > > projects in .NET, Java, PHP, Python, Perl, Lisp and even Ruby. > > > > If my team knew .NET inside out, then I'd build the product > > using .NET and vice-versa for PHP. It's expensive to throw > > away all your code, experience and knowledge of one language > > for the promise of greener grass. > > > > > > A more complicated question is should a PHP shop which has > > it's own set of libraries & glue framework move to the Zend > > Framework? This is much harder to answer due to having to > > weigh the cost of losing the investment in your current > > solution against the possible benefits of more productivity > > and less bugs due proper separation of concerns. > > > > > > Regards, > > > > Rob... > > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] .Net or Zend Framework?
On 10/7/07, Rob Allen <[EMAIL PROTECTED]> wrote: > Alex Netkachov wrote: > > I prefer to use .NET for complex long-term project when development is > > similar to RUP and PHP for "always-prototype" startups. > > > > Out of interest, what is a "complex long-term project"? I consider project is complex when it has many layers, have special performance requirements, contains hundreds of components, have a lot people involved in it. > Following on from that, why do you think that PHP isn't suitable for > such "complex long-term projects"? 1. I consider compilation and strong typization are very important in development because they help to avoid some basic typo-mistakes. 2. .NET provides a lot of functionality still not implemented in PHP. I especially interested in i18n and l10n of the applications. Formatting, encodings, locales, etc. ZF has all these now, but not in .NET contains such functionality just from the beginning. 3. One standard IDE for all developers. 4. More tools for code analyzing because of strong typization. Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] re: .net or zend framework?
On 10/6/07, Parnell <[EMAIL PROTECTED]> wrote: > I don't think it is so much .Net vs ZF becaust .Net in itself is a > pretty cool framework. > > The uncool part is: > > A) not open source BTW: MS will make .NET source code available to debug in next version of Visual Studio: http://www.alexatnet.com/node/87 > B) dependent on IIS and MSSQL Yes, .NET & MSSQL is fastest that I have ever seen. C) .NET is faster. > PHP + ZF is: > > A) open source (free and large community if any examples/help is needed) > B) can be run in just about any server environment C) PHP usually requires less code for the same functionality if you coding an algorithm or working with framework. Not types, type casts, easy for's and so on. > > Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] .Net or Zend Framework?
Hello, I prefer to use .NET for complex long-term project when development is similar to RUP and PHP for "always-prototype" startups. Sincerely, Alex On 10/6/07, rogeson <[EMAIL PROTECTED]> wrote: > > This is of course a no-brainer to me, but my current task is to convince the > company I work for to build our next product using the Zend Framework > instead of .Net, and there are a lot of .Net enthusiasts here. > > Does anybody have any good arguments as to how and why using PHP and the > Zend Framework is a superior choice to .Net? Has anybody had convince their > organization of the same sort of thing? > > Thanks! > > Roger > -- > View this message in context: > http://www.nabble.com/.Net-or-Zend-Framework--tf4580976s16154.html#a13076861 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] question about preDispatch
Hello, There is nothing wrong with the program flow in this case. Probably you expect _forward works like _redirect, e.g. it stops script execution, but it is not. Sincerely, Alex On 9/29/07, debussy007 <[EMAIL PROTECTED]> wrote: > > Hello all ! > > I have a problem with the preDispatch method : > > To check for authentication and authorization I created my own parent class > for all controllers (and for other common code). > And this parent class extends Zend_Controller_Action. > > I call in each controller the method preDispatch of the parent class I > created. > > function preDispatch() { > parent::preDispatch(); > echo 'other instructions here'; > } > > When the parent finds bad auth or acl rights, it forwards to the login page. > > The problem is that the instructions in the controllor below the parent call > are still executed. > E.G. in my code above the "other instructions here" string is displayed on > the screen. > > If the auth and/or ACL rights are wrong, these instructions shouldn't be > executed and I expect just a forward to the login page. > > This is the code of the parent preDispath method : > > public function preDispatch() > { > $this->view->baseUrl = $this->_request->getBaseUrl(); > > $auth = Zend_Auth::getInstance(); > $acl = Zend_Registry::get('acl'); > > if ( ! $auth->hasIdentity() ) { > $this->view->errorLogin = "You must be authenticated to view > this page."; > $this->_forward('index','auth'); > return; > } > > if ( ! $acl->isAllowed($auth->getIdentity()->type, 'partnerModule') ) > { > $this->view->errorLogin = "You are not allowed to view this > page."; > $this->_forward('index','auth'); > return; > } > } > > Thank you for any kind help ! > -- > View this message in context: > http://www.nabble.com/question-about-preDispatch-tf4540709s16154.html#a12959128 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Adding params to the Request
On 9/29/07, Ralf Kramer <[EMAIL PROTECTED]> wrote: > Am Donnerstag, den 27.09.2007, 15:25 -0500 schrieb Ralph Schindler: > > Actually, I did find that Rowset->toArray() does indeed return a > > reference to a protected member of the rowset object instead of an > > array. I marked that as a bug for rowset. > > > > http://framework.zend.com/issues/browse/ZF-1898 > > I dont know whether this is an issue, but the origin problem is already > solved, I just forgot to to call $rowset->current()->toArray() instead > of $rowset->toArray(); > > So the actual problem is imho in the return value of $table->find(1234); > which is a rowset, but I would expect a row since I search on a primary > key. Getting a row in this case feels somewhat more "natural" to me. The find() method accepts arrays with several primary keys and may return several records in a result. ZF developers consider to have one return type instead of changing it depending on number of records in the resultset. Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Validation for multi-column unique constraints
On 9/30/07, lauren49 <[EMAIL PROTECTED]> wrote: > > > Alex Netkachov wrote: > > > > I prefer combination of the following methods: > > 1. Check the uniqueness using a SELECT query. > > 2. Display error > > 3. After fixing error, execute data modification statemenet. > > 4. In case of error I can do either of the following: > > 4.1. parse error message and display error or if it fails > > 4.2. just show the general database error message and optionally > > 4.3. show the general database error message with recording exact > > message text to log > > > > Sincerely, > > Alex > > > > Thank you, Alex. > > Have you implemented these methods within the Zend Framework? Not yet. Maybe in a couple of weeks I'll complete refactoring of my system and will have this code. > -- > View this message in context: > http://www.nabble.com/Validation-for-unique-constraints-tf4537684s16154.html#a12960653 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Validation for multi-column unique constraints
I prefer combination of the following methods: 1. Check the uniqueness using a SELECT query. 2. Display error 3. After fixing error, execute data modification statemenet. 4. In case of error I can do either of the following: 4.1. parse error message and display error or if it fails 4.2. just show the general database error message and optionally 4.3. show the general database error message with recording exact message text to log Sincerely, Alex On 9/29/07, lauren49 <[EMAIL PROTECTED]> wrote: > > Hi, > > I understand that checking for a value's uniqueness against a db table > within in application is not a stable method and should not be relied upon > but the exception message thrown by a save attempt when a value is not > unique really doesn't make much sense to the user > > Caught exception: Zend_Db_Statement_Exception > Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate > entry '12-Report 21' for key 2 > > Instead I'd rather report a more user-friendly error message to the user > such as > > 'Report 21' already exists > > I'm very curious to hear how other's may have handled this problem. > > Thank you, > Lauren > > > -- > View this message in context: > http://www.nabble.com/Validation-for-multi-column-unique-constraints-tf4537684s16154.html#a12951118 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Date Picker
Hi, On 8/20/07, Jijo <[EMAIL PROTECTED]> wrote: > > Hi, > > Can anybody help me how to add date picker using zend framework. It is not related to ZF. Adding date picker is similar to adding any other JavaScript on a page. Basically, you need to modify your view script as described here: http://www.dynarch.com/demos/jscalendar/doc/html/reference.html#node_sec_3.1 > > Regards, > Jijo Anthony. > -- > View this message in context: > http://www.nabble.com/Date-Picker-tf4296833s16154.html#a12230633 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Zend Studio IDE 5.0
On 8/14/07, Kexiao Liao <[EMAIL PROTECTED]> wrote: > > Does Eclipse PDT support remote debuging from the server page? Yes. If you have debugger enabled on your server, you can debug the application using PDT. > > > Kexiao Liao wrote: > > > > Actually the PDO package has been installed on the server, and the Demo > > codes works well from the server. > > Do we need to install PDO plugin for the Eclipse PDT? > > > > Kevin > > > > > > Matthew Weier O'Phinney-3 wrote: > >> > >> -- Kexiao Liao <[EMAIL PROTECTED]> wrote > >> (on Tuesday, 14 August 2007, 12:20 PM -0700): > >>> I just download eclipsePDT with Zend Debugger plugin from > >>> http://www.zend.com/pdt#debugger, and debug the ZFGridDemo codes, > >>> following > >>> error message shown on the Debug Output. Since we are using Debuger > >>> function a lot, I wonder whether we can solve that problem? The Demo > >>> codes > >>> work well without using debugger. > >>> > >>> X-Powered-By: PHP/5.2.2 > >>> Set-Cookie: ZendDebuggerCookie=127.0.0.1%3A2%3A0||004|77742D65|1002; > >>> path=/ > >>> Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message > >>> 'The PDO extension is required for this adapter but not loaded' in > >> > >> Looks like the PHP version included with the IDE does not include PDO. > >> > >> -- > >> 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/Zend-Studio-IDE-5.0-tf4267730s16154.html#a12151609 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] How ZF works with PHP6 and are there any news on the subject?
On 8/14/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > > > Do you have any recent news about new PHP version? I searched a > > little, but everything I find is "Minutes PHP Developers Meeting", > > dated November 11th and 12th, 2005. > > If you mean PHP 6, it's being developed, new things getting added - > namespaces, ICU module, etc. but release date is probably "not this > year" :) As for PHP 5, 5.2.4 is on the way and next one would probably > be 5.3 with a bunch of interesting additions. > > You may want to look here: http://oss.backendmedia.com/HomePage for some > progress reports. It is an information that I need. Thank you, Stanislav. Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
[fw-general] How ZF works with PHP6 and are there any news on the subject?
Hello, Have any of you tested ZF with PHP6? Do you have any recent news about new PHP version? I searched a little, but everything I find is "Minutes PHP Developers Meeting", dated November 11th and 12th, 2005. Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Linked images in Email
AFAIK, Thunderbird does not display images in emails because of security settings. If you open Tools->Options->Privacy Tab->General and check "Block loading of remote images in mail messages" option. Sincerely, Alex On 8/13/07, Michael Baerwolf <[EMAIL PROTECTED]> wrote: > I'm trying to add linked images to an email. Using Zend_Mail > > $body = ' > > > src=http://www.something.com/images/image.jpg> > '; > $subject = 'test'; > $email = '[EMAIL PROTECTED]; > $mail = new Zend_Mail (); > $mail->setFrom ([EMAIL PROTECTED]); > $mail->addTo ($email); > $mail->setSubject ($subject); > $mail->setBodyHtml ($body); > try { > $mail->send(); > } catch (Exception $e) { > echo $e; > } > > This does not display the image in the email using Thunderbird as the > email client. Can anyone point me in the right direction? > > Thanks in advance for the help, > Mike > > > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] how to handle events
Hi, Not sure what do you mean by "events". You may consider events as a reaction on user's input, so it can be actions in MVC terms. Polymorphic methods of Zend_Db_Table also can be considered "events" in some cases. I also have a general article about events: http://www.alexatnet.com/node/28 Sincerely, Alex On 8/13/07, Rohit83 <[EMAIL PROTECTED]> wrote: > > Hi all, > can anybody help me out about how events are handled in Zend > Framework > > Regards, > Rohit > > -- > View this message in context: > http://www.nabble.com/how-to-handle-events-tf4261172s16154.html#a12126169 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Deploy Zend Framework Application
It is better to use url() view helper for creating URLs in view scripts. IT automatically adds current Base URL and you do not need to manage it. If you do not like url helper, you have to use application wide constant and use it in views just like you use $tableName. Sincerly, Alex On 8/13/07, Kexiao Liao <[EMAIL PROTECTED]> wrote: > > When I try to deploy Zend Framework Application from Development site to > Production site, the RewriteBase value from .htaccess file make deployment > much hard to do. Following is the example: > in my .htaccess file I declare a RewriteBase value as DevelopmentBase, and > in my index.phtml script template file, I use that RewriteBase value in the > following href attribue: > "href="/DevelopmentBase/grid/show/table/" >" > > When I try to deploy my Zend Framework Application to the Production site, I > have to use ProductionBase as RewriteBase value in the .htaccess file, so > the RewriteBase value has been changed from Development to Production, then > I have to change all the RewriteBase value in all the template script files. > For this kind of case, Is there a good solution to deploy application to the > production site? > -- > View this message in context: > http://www.nabble.com/Deploy-Zend-Framework-Application-tf4261581s16154.html#a12127371 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Zend_Json issue
Hi, On 8/12/07, Gunter Sammet <[EMAIL PROTECTED]> wrote: > Hi all: > We noticed yesterday on the IRC chat (zftalk) that there is an issue with > Zend_Json::encode: > > $test = array("test à test"); > $test2 = Zend_Json::encode($test); > print_r($test); > print('Encoded array: ' . $test2); > > $test2 contains only 'test '. This was done on PHP 5.2.1. Checking the > source code revealed that the encode function uses json_encode if existent. > Looking in the php docs ( > http://ca3.php.net/manual/en/function.json-encode.php) I > found the following comment: > > > Take care that json_encode() expects strings to be encoded to be in UTF8 > format, while by default PHP strings are ISO-8859-1 encoded. There is no "default" PHP strings encoding. PHP strings are byte-safe and store exactly thus sequence of bytes the parser loads. What you need is to save your file in UTF-8 encoding or use either mbstring or iconv extension to convert the chars to UTF-8. Sincerely, Alex -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] no php closing tag?
On 8/11/07, Vinny <[EMAIL PROTECTED]> wrote: > After going through the docs I realized that the examples with no end ?> > was not a typo. Is that for every php script that uses in the framework or > just the framework classes? Will something bad happen if you do use '?>' > ? How did that design decision come about? http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html > -- > Ghetto Java: http://www.streetprogrammer.com -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] Good example for a ZF crud app?
Hi, You may look here: BostonPHP Framework Presentations by Matthew Weier O'Phinney http://weierophinney.net/matthew/archives/137-BostonPHP-Framework-Presentations.html Getting started with the Zend Framework by Rob Allen http://akrabat.com/zend-framework-tutorial/ Sincerely, On 8/11/07, Vinny <[EMAIL PROTECTED]> wrote: > I'm a ZF newbie and I'm looking for some direction on where I should put > various > classes. For example, should I put all my connectton database logic in > controller > action methods or is there a preffered layout? > Thanks, > Vinny > > -- > Ghetto Java: http://www.streetprogrammer.com -- http://www.alexatnet.com/ - consulting, blog, articles and support for PHP, ZF, JavaScript and web development.
Re: [fw-general] sticky form fields
I'm using Ajax form submits :-) or the Form classes that I created, they contains all logic like this. Sincerely, On 8/6/07, David Mintz <[EMAIL PROTECTED]> wrote: > Let's suppose you want to render a form back at the user with the same > values they just gave you. In something.phtml you might have > > formText('email',$this->email, > array('size=>40'))?> > > .. And this In your controller: > > function somethingAction() { > >$this->view->assign($this->_request->getParams()); > } > > This seems to work fine, but it seems you will be repeating that line quite > often. What approach are you guys using? > > Thanks. > > -- > David Mintz > http://davidmintz.org/ > > The subtle source is clear and bright > The tributary streams flow through the darkness -- Alex - http://www.alexatnet.com/ - - Articles, discussions and subpport for PHP, ZF, JavaScript and web development -
Re: [fw-general] retrive data from database to combobox
Hi, Query the database using the Zend_Db classes and then use formSelect view helper to create a control. Sincerely, On 8/6/07, Jijo <[EMAIL PROTECTED]> wrote: > > hi, > > can anybody help me how to store data in select box by retriving it from > database > > regards, > Jijo Anthony > -- > View this message in context: > http://www.nabble.com/retrive-data-from-database-to-combobox-tf4222723s16154.html#a12012296 > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- Alex - http://www.alexatnet.com/ - - Articles, discussions and subpport for PHP, ZF, JavaScript and web development -
Re: [fw-general] Retrieve ID Number
Hi, insert() returns exactly you need. http://framework.zend.com/apidoc/core/Zend_Db/Table/Zend_Db_Table_Abstract.html#insert return: The last insert ID. Sincerely, On 5/4/07, José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote: Hi friends, I am inserting a new record in a DB, but, I would like to retrieve the ID of the new record... How can I do that? $data = array( 'fun_nome'=> $fun_nome, 'fun_cpf' => $fun_cpf, 'fun_cep' => $fun_cep, 'fun_observacoes' => $fun_observacoes, 'fun_data'=> date("Y-m-d h:i:s"), ); $funcionarios = new Funcionarios(); $funcionarios->insert($data); <--- here! best regards, José de Menezes -- Alex http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and Ajax.
Re: [fw-general] Ordering findDependentRowset
Hi, Just have an idea: Is it make sense to have getDependentRowsetSelect(...) and then use: $rowset = $row->getDependentRowsetSelect (...)->where(...)->limit(...)->query(...); and findDependentRowset() will call to this method first. I think this will be a good solution that will not the complicate findDependentRowset() method and gives us a method to extend its behavior. Sincerely, P.S. Sorry, Rob. More recipients. On 4/29/07, Rob Allen <[EMAIL PROTECTED]> wrote: Alan Gabriel Bem wrote: > > Luke Barton wrote: >> Do we have a method of ordering result rowsets retrieved by relationship? >> > > http://framework.zend.com/issues/browse/ZF-1182 Read this issue . It is not > exactly what you want - but covers in some part. http://framework.zend.com/issues/browse/ZF-1241 also covers similar issues related to retrieving related row sets. Regards, Rob... -- Alex http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and Ajax.
Re: [fw-general] Config SET
Hi Ian, I believe you need to use either $config->db->__set('dbname', 'somename'); or $config->db->dbname = 'somename'; but not $config->__set('db.host', ' 127.0.0.1'); Sincerely, On 4/17/07, Ian Warner <[EMAIL PROTECTED]> wrote: I have the following code Allow modifications is set to on so should be ok. But the SET does not seem to be working. Maybe cause what I need to set is an array? // Loop through the databases foreach ($databases as $k => $v) { $config->__set('db.dbname', $v['Database']); $db = Zend_Db::factory($config->db_adapter, $config->db->asArray()); Zend_Debug::dump($config->db, 'Config', true); // Query to retrieve the tables within the database $sql= $db->query('SHOW TABLES'); $tables = $sql->fetchAll(); Zend_Debug::dump($tables, 'Tables', false); } db.host = localhost db.username = root db.password = db.dbname = admin db.profiler = true db.useSQL = false db_adapter = PDO_MYSQL -- Alex http://www.alexatnet.com/ - Blog and CMS created with Zend Framework and Ajax.