-- O'BRIEN, Steven X <[EMAIL PROTECTED]> wrote
(on Tuesday, 28 October 2008, 04:47 PM -0000):
> Ok, this is a very general.
>
> I am getting annoyed about all the strings I have to remember with the Zend
> Framework.
>
> Things like:
>
> getValidator('Authorise')
>
> Or form factory methods:
> $username = $this->getElement('username')
> ->addValidator('alnum')
> ->setRequired(true)
> ->addFilter('StringTrim')
> ->addValidator('Authorise');
>
> I am using eclipse PDT at the moment which provides good intellisense when
> code
> is documented well enough,
> but it is obviously not man enough to work out the possible strings a function
> could take. C# family of languages solved this with enums.
>
> When you are setting a parameter that is one of a list of pre defined values
> it
> pops up a list of what it knows about.
>
> For example when I type addFilter( i should get a list of all the filters i
> can
> use). I am tempted to add enum classes and start registering things like this.
>
> Another good example are view scripts I have to refer back to the controller
> every time to work out what variables the view has access to. boo hoo hoo
>
> Am I being too fussy? Have I been spoilt by strongly typed languages?
> Ultimately you shouldn't solely rely on an IDE's interpretation but it saves
> SOO much time especially when scooting from project to project then back
> again.
>
> Does any one else out there share my pain? Have any work arounds / ideas?
It's actually a pretty big problem set... because the strings are not
necessarily pre-defined, and will be different based on how you
configure your objects, what classes you define, and what prefix paths
you register with various plugin handlers.
Sure, we have 'StringTrim', 'Alnum', and 'Authorise'... but what if you
define your own filters, validators, or decorators, and add them to the
prefix path for your form and/or element? Now you may have an additional
set -- or alternate classes that override standard ones (your own
'My_Filter_StringTrim', for instance). It's not equivalent to an ENUM at
all.
The ZSfE team is actively working on this, but there's no easy solution.
The good news is that if they solve it at the PluginLoader level,
they've solved it for the majority of classes with plugins in ZF.
> -----Original Message-----
> From: Bradley Holt [mailto:[EMAIL PROTECTED]
> Sent: 28 October 2008 16:30
> To: Zend Framework General
> Subject: [fw-general] Truncate String
>
> Is there a simple way in ZF to truncate a string? I searched and didn't
> find any talk of a ZF specific component for this. I also looked at the
> list of standard filter classes and didn't see anything there either. I
> know there are tons of possible ways to do this - I'm just surprised there
> isn't anything in ZF yet so perhaps I'm just not looking in the right
> place.
>
> Thanks,
> Bradley
>
> --
> Bradley Holt
> [EMAIL PROTECTED]
>
>
> This mail has originated outside your organization, either from an
> external partner or the Global Internet.
> Keep this in mind if you answer this message.
>
>
> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other then the addressee. Access to this e-mail
> by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus immediately and
> delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness of
> this e-mail as it has been sent over public networks. If you have any
> concerns over the content of this message or its Accuracy or Integrity,
> please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated virus
> scanning software but you should take whatever measures you deem to be
> appropriate to ensure that this message and any attachments are virus free.
>
> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other then the addressee. Access to this e-mail
> by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus immediately and
> delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness of
> this e-mail as it has been sent over public networks. If you have any
> concerns over the content of this message or its Accuracy or Integrity,
> please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated virus
> scanning software but you should take whatever measures you deem to be
> appropriate to ensure that this message and any attachments are virus free.
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/