Re: [fw-general] Extendable models with MySQL, Zend_Db_Table and Zend_Form

2008-06-25 Thread Ralf Eggert
Hi Bill, Aaron, Fedrico and Peter,

thanks for your input so far. After reading your mails and some
intensive googling, I think the "one custom table for each client"
solution is the way to go. These custom tables must be altered by the
site administrator whenever a column needs to be added, changed or dropped.

I will extend Zend_Db_Table for my needs to join the custom tables for
the current client by default. And I will extend Zend_Form to create
elements for the base colums first and the custom client columns
afterwards.

I think that will be the way to go. Thanks again for your input (special
thanks to Bill).

Thanks and Best regards,

Ralf


Re: [fw-general] Extendable models with MySQL, Zend_Db_Table and Zend_Form

2008-06-25 Thread Bill Karwin



Ralf Eggert wrote:
> 
> Now, there are a couple of clients which need to extend this "jobs"
> table with custom columns. For example client A wants to add a location
> and a requirements column and client B wants to add the salary and a
> services column. When client A wants to create or edit a job, only the
> base columns and "his" columns should be displayed in the form and the
> data should be saved in the "jobs" table. This system should be as
> flexible as possible and the site administrator should be able to add
> columns for each client whenever he wants to.
> 

To me, "beautiful code" means that we designed it using a set of assumptions
about the structure and usage, and we don't have to support exceptions to
those assumptions.  Ugly code is when we're told "make it as flexible as
possible" and we just have to do it.  So no matter what solution you use,
it's going to be more or less ugly.

The EAV design that was suggested in another comment is an SQL Antipattern
as far as I'm concerned.  It's not a good solution for your case because it
gives you no control over the attributes.  That is, each row could
potentially have a different set of attributes.  I assume you want each
client to use a fixed set of attributes, but this is unenforceable with EAV.

Creating a single table with hundreds of columns, as the union of all
columns any client might need is called "single-table inheritance."  This
works, but you'd really want to enforce that attributes must be NULL except
for clients who need them.  The database can't enforce this.  Also, most
people find it ugly to create hundreds of columns that are NULL most of the
time.

The best option, the one I would recommend in this case, is to create a
dependent table per client who needs custom columns.  The advantage is that
the database structure allows each client only their respective set of
columns (base + custom) for all rows, yet the database doesn't need to store
lots of extra data.  The primary key of each client's custom table is not
auto_increment, but instead is a foreign key to the main jobs table.  

Yes, you will create a lot of tables, one per client.  But it's a one-time
CREATE when you set up a client, and you won't need to access the custom
tables except when that client is logged in.

You should _not_ create an attribute in the base jobs table to tell which
table references a given row.  This is done to support Polymorphic
Associations, which is another SQL Antipattern.  When you generate the form,
you know the client id of the current client, so you know which table to use
(name the tables by some convention mapping the client id into the table
name).  You need to build the join query dynamically from this information. 
Zend_Db_Select makes it pretty easy to do this safely (quoting table
identifiers, etc.).

Regards,
Bill Karwin
-- 
View this message in context: 
http://www.nabble.com/Extendable-models-with-MySQL%2C-Zend_Db_Table-and-Zend_Form-tp18105740p18125630.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Extending controllers : problems with view

2008-06-25 Thread mbneto
Hi,

I've developed a module and I need to extend it just to provide a different
layout/source (database).  Since my database models use Zend_Db i've added a
prefix to the construct so I have different tables with the same columns.

ex. tables news and foo_news

My extended controller looks like this

Foonews_IndexController extends News_IndexController
{
   init()
   {
   $this->_request->setParam('prefix', 'foo');
   parent::init();
   }
}

The problem is that when I call the Foonews index action it renders the
index.tpl of news instead of foonews.

Ex.
News_IndexController
{

  function init()
  {
 $this->_prefix = $this->_request->getParam('prefix');
  }

   function indexAction()
   {
// do the business
  $this->render('index');   // Renders the
application/news/views/scripts/index/index.tpl
  $this->render('foo_index');  // Renders the
application/foonews/views/scripts/index/foo-index.tpl
  $this->render('en/index'); // Renders the
application/foonews/views/scripts/index/en/index.tpl
   }

}

I am using a view helper in order to use smarty as template system so it can
be a  problem with the class that I am using so I am looking for tips to
either replace it for a new one or correct that (if I know what is wrong).

The class is Naneau_View_Smarty (
http://naneau.nl/category/web-development/zend-framework/)

Regards.


Re: [fw-general] Extendable models with MySQL, Zend_Db_Table and Zend_Form

2008-06-25 Thread AHeimlich


Ralf Eggert wrote:
> 
> right now I am thinking about a problem with extendable models. To
> explain this a bit, please think about a "jobs" table. This table has
> some base columns like id, date, title, description and status. No
> problem at all to build a model class with Zend_Db_Table and to build a
> form with Zend_Form.
> 
> Now, there are a couple of clients which need to extend this "jobs"
> table with custom columns. For example client A wants to add a location
> and a requirements column and client B wants to add the salary and a
> services column. 
> 

There's an article in this month's php|architect[1] entitled "EAV Modeling"
that describes a way of handling situations very much like yours. Perhaps it
could be of some use to you.

[1] http://www.phparch.com/
-- 
View this message in context: 
http://www.nabble.com/Extendable-models-with-MySQL%2C-Zend_Db_Table-and-Zend_Form-tp18105740p18124652.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Extendable models with MySQL, Zend_Db_Table and Zend_Form

2008-06-25 Thread Federico Cargnelutti
A form builder solves this problem. For example, if you have 3 tables:

form
form_element
form_element_option

The design scales vertically instead of horizontally, as you only need to
worry about the data and not the structure. Then you can use something like
Web Forms 2.0 to build or edit the form (add or remove columns) on the
client side, and then generate the form using Zend_Form on the server side.

I used Web Forms in the past and it's great:

Site:
http://code.google.com/p/webforms2/

Test suite:
http://webforms2.googlecode.com/svn/trunk/testsuite/index.html

Regards,

Federico

On Wed, Jun 25, 2008 at 7:34 AM, peter fiksman <[EMAIL PROTECTED]> wrote:

>
> Hello Ralf,
>
> I see here two data-related design issues which are not necessary related
> to
> the Zend Framework as such.
>
> 1) a table with _hundreds_ of columns looks a bit weird to me because a
> table is a relation of many attributes, or represents some business entity
> object; normally such super-object will need more granularity
>
> 2) still, there is technically no problem to have a table with many
> columns;
> what you want to record here related to your clients is the relation "a
> column can be owned by one or more clients" i.e. many-to-many relation?
> so you could create another table, (colname, client_id) to manage that. (if
> n:1 then colname column has to be unique; vice versa, a client will still
> be
> able to have many columns)
>
> best regards,
> Peter Fiksman
> Software-Architekt
>
> 
> pf-webservices
> Grantham-Allee 20
> 53757 Sankt Augustin
>
> Tel.:  +49 (0) 2241 397 2135
> Fax:   +49 (0) 2241 397 2139
> Mobil: +49 (0) 177  976 3257
>
> Email: [EMAIL PROTECTED]
> Web: http://pf-webservices.de
> Ust-Id: DE223139117
>
>
> - Original Message -
> From: "Ralf Eggert" <[EMAIL PROTECTED]>
> To: "Zend Framework General" 
> Sent: Wednesday, June 25, 2008 8:12 AM
> Subject: [fw-general] Extendable models with MySQL, Zend_Db_Table and
> Zend_Form
>
>
> > Hi,
> >
> > right now I am thinking about a problem with extendable models. To
> > explain this a bit, please think about a "jobs" table. This table has
> > some base columns like id, date, title, description and status. No
> > problem at all to build a model class with Zend_Db_Table and to build a
> > form with Zend_Form.
> >
> > Now, there are a couple of clients which need to extend this "jobs"
> > table with custom columns. For example client A wants to add a location
> > and a requirements column and client B wants to add the salary and a
> > services column. When client A wants to create or edit a job, only the
> > base columns and "his" columns should be displayed in the form and the
> > data should be saved in the "jobs" table. This system should be as
> > flexible as possible and the site administrator should be able to add
> > columns for each client whenever he wants to.
> >
> > My problem is now how to implement this with Zend_Db_Table and
> > Zend_Form. I think it is not such a good idea to add each column to the
> > "jobs" table because there could be hundreds of columns in future.
> >
> > Another idea was to have one "additional" column of type "text" in
> > "jobs" with can hold a serialized array with the additional data for
> > each clients job. But then some of these extra fields will be needed for
> > selecting and sorting the jobs of each client, which will be almost
> > impossible when using a MySQL text column.
> >
> > Then I was thinking of an extra table for each client, say "jobs_a" and
> > "jobs_b" which can be accessed and amended by the site administrator.
> > These extra tables could be joined with Zend_Db_Table and I could work
> > with merged Zend_Config objects to work with Zend_Form. But this will
> > result in a lot of tables in the database.
> >
> > Does anybody have some suggestions how to handle this problem? Are there
> > any best practices or design patterns for this?
> >
> > Thanks and best regards,
> >
> > Ralf
>
>


Re: [fw-general] Wysiwyg pages with Zend_form

2008-06-25 Thread Bart McLeod
I like fckeditor (www.fckeditor.net). It integrates into anything. You 
can create your own zend_form_element descendant for it and it will do 
great, I am going to do this within two weeks anyway.


Bart

Bradley Holt schreef:
I haven't tried it yet, but I'd recommend taking a look at WYMeditor 
. It's WYSIWYM (What You See Is What You 
Mean) instead of WYSIWYG.


On Wed, Jun 25, 2008 at 3:03 PM, Lior Messinger 
<[EMAIL PROTECTED] > wrote:



Hi all

i'm new at ZF, and would like to use it since I've heard great
things. But,
i'm a little at awe on how should i design a web form, Wysiwyg style.

>From the many posts and documentation, it seems that I need to
put all the
html code and tags as decorators. Could that be? It would make it
really
complex to design and maintain.

Alternatively, I thought of is building the page in dreamweaver,
changing it
to phtml, and then enclose form elements as  form->getValue('firstName'); ?> or form->getElement('firstName'); ?> (for the edit boxes).
would that
work?

Is there another option? Any Wysiwyg Zend-supporting editors?

thanks SO MUCH for ANY idea
Lior
--
View this message in context:
http://www.nabble.com/Wysiwyg-pages-with-Zend_form-tp18119647p18119647.html
Sent from the Zend Framework mailing list archive at Nabble.com.




--
Bradley Holt
[EMAIL PROTECTED] 



Re: [fw-general] Wysiwyg pages with Zend_form

2008-06-25 Thread Bradley Holt
I haven't tried it yet, but I'd recommend taking a look at
WYMeditor.
It's WYSIWYM (What You See Is What You Mean) instead of WYSIWYG.

On Wed, Jun 25, 2008 at 3:03 PM, Lior Messinger <[EMAIL PROTECTED]>
wrote:

>
> Hi all
>
> i'm new at ZF, and would like to use it since I've heard great things. But,
> i'm a little at awe on how should i design a web form, Wysiwyg style.
>
> From the many posts and documentation, it seems that I need to put all the
> html code and tags as decorators. Could that be? It would make it really
> complex to design and maintain.
>
> Alternatively, I thought of is building the page in dreamweaver, changing
> it
> to phtml, and then enclose form elements as   $this->form->getValue('firstName'); ?> or  $this->form->getElement('firstName'); ?> (for the edit boxes). would that
> work?
>
> Is there another option? Any Wysiwyg Zend-supporting editors?
>
> thanks SO MUCH for ANY idea
> Lior
> --
> View this message in context:
> http://www.nabble.com/Wysiwyg-pages-with-Zend_form-tp18119647p18119647.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
Bradley Holt
[EMAIL PROTECTED]


[fw-general] Wysiwyg pages with Zend_form

2008-06-25 Thread Lior Messinger

Hi all

i'm new at ZF, and would like to use it since I've heard great things. But,
i'm a little at awe on how should i design a web form, Wysiwyg style. 

>From the many posts and documentation, it seems that I need to put all the
html code and tags as decorators. Could that be? It would make it really
complex to design and maintain.

Alternatively, I thought of is building the page in dreamweaver, changing it
to phtml, and then enclose form elements as  form->getValue('firstName'); ?> or form->getElement('firstName'); ?> (for the edit boxes). would that
work? 

Is there another option? Any Wysiwyg Zend-supporting editors? 

thanks SO MUCH for ANY idea
Lior
-- 
View this message in context: 
http://www.nabble.com/Wysiwyg-pages-with-Zend_form-tp18119647p18119647.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Db, pdo_mysql, Transaction Support?

2008-06-25 Thread Jake McGraw
> The default table handler in MySQL is MyISAM which doesn't support
> transactions. InnoDB does support transactions.

Ahh, that makes sense, the tables in question are MyISAM. Thanks for the input.

- jake

On Wed, Jun 25, 2008 at 12:31 PM, James Dempster <[EMAIL PROTECTED]> wrote:
> For transactions to work on MySQL the table handlers is required to support
> transactions.
>
> The default table handler in MySQL is MyISAM which doesn't support
> transactions. InnoDB does support transactions.
>
> Double check that you are using a table handler that supports transactions.
>
> /James Dempster
>
> On Wed, Jun 25, 2008 at 4:56 PM, Jake McGraw <[EMAIL PROTECTED]> wrote:
>>
>> Here's the code:
>>
>> http://rafb.net/p/GEpl5468.html (Code paste site)
>>
>> My problem is that the first insertion is always successfully
>> committed to the database, even when I throw an exception. I've read
>> up on the way pdo_mysql handles "transactions", none of my code
>> performs any task on DDLs, so my question is:
>>
>> Does Zend_Db using pdo_mysql support transactions?
>>
>> - jake
>
>


Re: [fw-general] two problems with zend form

2008-06-25 Thread DaveCool

Ok nevermind. I found out about the ViewScript decorator. That made things a
lot easier. 

For anyone reading this who is trying to create a complicated form, this
article http://devzone.zend.com/article/3450-Decorators-with-Zend_Form

was a big help...just make sure to use $this->element, not $this->form as it
says in the article. That caused a few headaches trying to fix.

-Dave


DaveCool wrote:
> 
> The first is pretty simple...
> 
> 

-- 
View this message in context: 
http://www.nabble.com/two-problems-with-zend-form-tp18096470p18115903.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Db, pdo_mysql, Transaction Support?

2008-06-25 Thread James Dempster
For transactions to work on MySQL the table handlers is required to support
transactions.

The default table handler in MySQL is MyISAM which doesn't support
transactions. InnoDB does support transactions.

Double check that you are using a table handler that supports transactions.

/James Dempster

On Wed, Jun 25, 2008 at 4:56 PM, Jake McGraw <[EMAIL PROTECTED]> wrote:

> Here's the code:
>
> http://rafb.net/p/GEpl5468.html (Code paste site)
>
> My problem is that the first insertion is always successfully
> committed to the database, even when I throw an exception. I've read
> up on the way pdo_mysql handles "transactions", none of my code
> performs any task on DDLs, so my question is:
>
> Does Zend_Db using pdo_mysql support transactions?
>
> - jake
>


[fw-general] Zend_Db, pdo_mysql, Transaction Support?

2008-06-25 Thread Jake McGraw
Here's the code:

http://rafb.net/p/GEpl5468.html (Code paste site)

My problem is that the first insertion is always successfully
committed to the database, even when I throw an exception. I've read
up on the way pdo_mysql handles "transactions", none of my code
performs any task on DDLs, so my question is:

Does Zend_Db using pdo_mysql support transactions?

- jake


[fw-general] Zend_Pdf max point size for fonts?

2008-06-25 Thread spaceage

What is the max point size for font rendering supported in the Zend_Pdf
component?  Illustrator currently supports a max of 1296pt (18" height).  Is
this the case for Zend_Pdf also, or is there some other upper limit? 
Thanks, David
-- 
View this message in context: 
http://www.nabble.com/Zend_Pdf-max-point-size-for-fonts--tp18115854p18115854.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Form Element Required

2008-06-25 Thread Alex

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)


[fw-general] help with existing sessions

2008-06-25 Thread 1world1love

Greetings all. I am new to Zend (and relatively new to php) and had a
question about how to manage overlaps between native php sessions and
Zend_Sessions.

I have an app that is served as part of a larger group of apps that all
share a common authentication service (a fairly common scenario: Before a
user can access any resource within the domain they must be authenticated
through the common login page and are then allowed access to any of the
resources).

In any case, I have written this app using Zend_Session and I am wondering
how I handle the fact that the session will have been created by the central
login page. 

Is there a way to merge the existing native php session into my Zend_Session
managed session?

Can I extract the login information from the session and kill it to be able
to start my Zend_Session?

If I just revert to the native session will I not be able to store objects?

Moving my app from the central auth environment is not an option, but I
really like Zend and would like to find a way to continue to use the
Zend_Session api. Any help would be appreciated.

Thanks in advance,

j
-- 
View this message in context: 
http://www.nabble.com/help-with-existing-sessions-tp18114439p18114439.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Help with support for multiple languages

2008-06-25 Thread robert mena
Hi,
Recently I've received the assignment to develop all of our products
(software modules) with support for multiple languages.  In order to avoid
problems with things like japanese (or other non iso8859-1) I've switched
all the environment to use utf-8.  Database tables, files and webserver will
all output utf-8 as default for the 'new' products.

My next step is to decide how to better support this feature in the model/db
and php itself since the admin user will have to choose which language
he/she will be using for that news entry (for example) so that if the end
user chooses to view the english version of the site he/she will only see
those news entries that were inserted as such.

Why am I asking this here:
a)I am using ZF for all new products so I'd like to know if there is any
component to help me out
b) Probably someone has/has the same problem
c) I do not want to reinvent the wheel more than I have to

>From the model standpoint seems that adding a column lang to the tables that
hold the information a safe choice.  But how about the views?  Should I
create separate views, one for each supported lang, should I create just one
with variables for all strings/buttons (and those coming from a ini/xml
file)?

Thanks.


Re: [fw-general] Zend Form: Trying to add a Label Decorator to a DisplayGroup

2008-06-25 Thread jkendall

I should have paid more attention to the errors that I was getting.  They
gave me the road map to extending DisplayGroup properly.  By extending
Zend_Form_DisplayGroup and including the following methods, I was able to
successfully apply a label to a DisplayGroup:

  public function setLabel($label) {
  return $this->setAttrib('label', (string) $label);
  }

  public function getLabel() {
  return $this->getAttrib('label');
  }
  
  public function setRequired($flag) {
  $this->_required = (bool) $flag;
  return $this;
  }

  public function isRequired() {
  return $this->_required;
  }


jkendall wrote:
> 
> By default, a display group is wrapped in a Fieldset, allowing for a
> legend at the top of your display group.  I have a use case where I'd like
> to wrap the display group in li tags and add a label at the top:
> 
> 
> 
> Blah
> 
> DISPLAY GROUP
> 
> 
> 
> Attempting to add a Label element to a display group results in the
> following error: Call to undefined method
> Zend_Form_DisplayGroup::getLabel() in Zend/Form/Decorator/Label.php on
> line 242.
> 
> Subclassing DisplayGroup and adding a getter and setter for Label results
> in: Call to undefined method SJCRH_Form_DisplayGroup::isRequired() in
> Zend/Form/Decorator/Label.php on line 260.
> 
> Obviously, I'm missing something in regards to DisplayGroup and how it
> relates to Decorators, but I can't seem to figure it out.  Any help?
> 


-
Jeremy Kendall --  http://www.jeremykendall.net http://www.jeremykendall.net 
-- 
View this message in context: 
http://www.nabble.com/Zend-Form%3A-Trying-to-add-a-Label-Decorator-to-a-DisplayGroup-tp18097521p18112606.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Logrotate for Zend_Log

2008-06-25 Thread Wolfgang Forstmeier
> We have no proposals currently to add such functionality... so, if you
> have the time and inclination, please feel free to do so!

I will try to do that if I have got some free time.


On Wed, Jun 25, 2008 at 2:57 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I solve this problem by extending the Zend_Log_Writer and implemented a
> Zend_Log_Writer_Syslog for my consumption. If you want I can provide you
> with the code.

It would be nice if you could serve this to me, maybe your code will
fit my needs and I have some less work.
If that will fit I will spend you some beer ;-).

-- 
Mit freundlichen Grüßen
With best regards

Wolfgang Forstmeier
---
+49° 34' 26.76", +11° 0' 48.60"
---
mailto:[EMAIL PROTECTED]


Re: [fw-general] Logrotate for Zend_Log

2008-06-25 Thread [EMAIL PROTECTED]
I solve this problem by extending the Zend_Log_Writer and implemented a
Zend_Log_Writer_Syslog for my consumption. If you want I can provide you
with the code.

On Wed, Jun 25, 2008 at 7:47 PM, Wolfgang Forstmeier <
[EMAIL PROTECTED]> wrote:

> Hey List,
>
> I would like to know if someone has already thougth about an mechanism
> for rotating logs withing Zend_Log.
>
> As far as I know there is no really clever way to do that with current
> features.
>
> --
> With best regards
>
> Wolfgang Forstmeier
> ---
> mailto:[EMAIL PROTECTED]
>



-- 

Favorite Quotes:

For I know the plans I have for you," declares the LORD, "plans to prosper
you and not to harm you, plans to give you hope and a future.
-- Jeremiah 29:11 - New International Version (NIV)


This email and/or attachments are confidential and may also be
legally privileged. If you are not the intended recipient, you are
hereby notified, that any review, dissemination, distribution or
copying of this email and/or attachments is strictly prohibited.
Please notify [EMAIL PROTECTED] immediately by email and
delete this message and all its attachments. Thank you.


Re: [fw-general] Logrotate for Zend_Log

2008-06-25 Thread Matthew Weier O'Phinney
-- Wolfgang Forstmeier <[EMAIL PROTECTED]> wrote
(on Wednesday, 25 June 2008, 01:47 PM +0200):
> I would like to know if someone has already thougth about an mechanism
> for rotating logs withing Zend_Log.
> 
> As far as I know there is no really clever way to do that with current 
> features.

We have no proposals currently to add such functionality... so, if you
have the time and inclination, please feel free to do so!

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Unit testing active record models

2008-06-25 Thread Matthew Weier O'Phinney
-- davidwinterbottom <[EMAIL PROTECTED]> wrote
(on Tuesday, 24 June 2008, 11:45 PM -0700):
> When you have an active record style model that uses a db adapter from a
> registry, what's the best practise for unit testing?  Do you use a mock
> object in the registry, use a test database, clean up the dev database after
> inserting new records, or something else?
> 
> For instance, my User model has a save method like...
> 
> class User 
> 
> public function save() {
>  ...
>  $Db = Zend_Registry::get(REGISTRY_DB);
>  if ($this->id) {
>  $Db->update(self::TABLE, $attributes, 'UserId='.$this->id);
>  } else {
>  $attributes['DateCreated'] = date(MYSQL_DATE_FORMAT);
>  $Db->insert(self::TABLE, $attributes);
>  $this->id = $Db->lastInsertId();
> }
> }
> 
> and so, as the db adapter is held in a registry, it is not as
> straightforward as normal to pass in a mock object for the db adapter.  How
> do other people manage this situation (which must be awfully common)?  Do
> you just allow yourself to write to the normal db and clean up afterwards
> (so there aren't loads of test users in there)?  Or use a special testing db
> so the mess doesn't matter?  Or something I've not thought of?

I usually use one of the following approaches:

 * Test DB (usually sqlite, so I don't have to depend on network access
   or a running DB server on my machine).
 * In-memory sqlite database. This usually requires a little more setup
   in your test harness, but the speed is unbeatable.

If you look at how Rails recommends testing, both of the above fit in
with their recommendations -- separate dataset for testing than for
production.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Logrotate for Zend_Log

2008-06-25 Thread Wolfgang Forstmeier
Hey List,

I would like to know if someone has already thougth about an mechanism
for rotating logs withing Zend_Log.

As far as I know there is no really clever way to do that with current features.

-- 
With best regards

Wolfgang Forstmeier
---
mailto:[EMAIL PROTECTED]


[fw-general] Strange problem with Zend_Form

2008-06-25 Thread Matthew Ishii
I've taken a queue from the Zend Framework site's Quickstart and
created a form for a simple login. However I did so in a slightly
different way, and as a result I'm getting a 'Notice' thrown.  Why
should I receive a notice while the Quickstart version does not?  The
two bits of code are very very similar.

Notice: Array to string conversion in
/home1/ioforgec/zendev/library/Zend/View/Helper/FormElement.php on
line 55

Here is the way I've instantiated the form:

 $submit = array('submit', array('label' => 'Log In'));

 $struct = array('uname' => array('text', array('required' =>
true, 'label' => 'Username')),
   'pword' => array('password',
array('required' => true, 'label' => 'Password')));

 $config = array('method' => 'post', 'elements' => $struct,
'submit' => $submit, 'action' => '/index/login');

 $form = new Zend_Form(array('method' => 'post', 'elements' =>
$struct, 'submit' => $submit, 'action' => '/index/login'));
 //$form = new Zend_Form($config);

 return $form;

As you can see I've tried both instantiating Zend_Form with the fully
typed out parameters, and I've tried it by passing an array, either
way the notice is thrown.  I realize this is only a notice, however i
don't understand what I'm doing differently than the code in the
Quickstart which just to remind looks like this:

$form = new Zend_Form(array(
'method'   => 'post',
'elements' => array(
'comments' => array('textarea', array(
'required' => true,
'label' => 'Write your comments'
)),
'submit' => array('submit', array(
'label' => 'Add Comment'
))
),
));

return $form;

Thanks in advance ...


[fw-general] required zend_form_element with value '0' (NotEmpty)

2008-06-25 Thread Spring Pierre

hi all,

if i set an
$element = Zend_Form_Elenemt();
$element->setRequired(true);
to be required and the user inputs '0', the
$element->isValid()
returns false.

this is due to the implementation of the Zend_Validate_NotEmpty  
validator, that checks if a value is empty($value).


empty('0'); // => false

the Zend_Validate_NotEmpty has been addressed both in the bugtracker  
[1] and the mailinglist [2]. as it seems, the implementation of the  
Zend_Validate_NotEmpty is not likely to change, taken the fact that it  
was intended to map the native php function empty() [3].


but the problem remains. my user inputs 0 (say the number of children  
he has) and the system tells him to fill out the form ;) it wont take  
0 for an answer...


to sum it up, here are some of my questions:

* is this considered a problem?
* should NotEmpty be changed after all?
* should we implement a NotNull validator?

yours.
pierre spring.
who really enjoys working with the zFramework.
==
[1] http://framework.zend.com/issues/browse/ZF-2851
[2] 
http://www.nabble.com/Zend_Validate_NotEmpty-special-case-to-handle-%270%27-td15232397.html#a15232397
[3] http://php.net/manual/en/function.empty.php
--
Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg
Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch






PGP.sig
Description: This is a digitally signed message part