Re: [fw-general] Problem with autoloading and unit testing Zend_Application

2009-10-01 Thread Aycko

Push.


Aycko wrote:
 
 All classes which are loaded with Zend_Application_Module_Autoloader in
 module bootrap could not be found. The autoloaders are defined in
 application bootstrap and module bootstrap ... this works great, but not
 fpr testing.
 Defining the Zend_Application_Module_Autoloaders in bootstrap file in
 tests folder dont works. Including the missing miles via require_once
 works, but this is not very comfortable.
 
 
 funkyfly wrote:
 
 Can you provide more detailed information about the fatal error?
 --
 Regards,
 Vladas Diržys
 
 
 On Fri, Sep 25, 2009 at 13:18, Aycko aycko.maer...@gmx.de wrote:
 



 Aycko wrote:
 
  Hello together,
 
  i set up a basic environment for unit testing my Zend_Application.
 
  A basic test looks something like this:
 
  public function testDefaultControllerAndAction() {
  $this-dispatch('/');
  $this-assertController('index');
  $this-assertAction('index');
  }
 
  Calling phpunit in command line causes some php fatal errors. All
 classes
  which are loaded with Zend_Application_Module_Autoloader in module
 bootrap
  could not be found.
 
  Are there any solution without setting up all requires manually?
 
 
  Best regards
  Aycko
 

 Any ideas?
 --
 View this message in context:
 http://www.nabble.com/Problem-with-autoloading-and-unit-testing-Zend_Application-tp25534200p25609668.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-autoloading-and-unit-testing-Zend_Application-tp25534200p25693457.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend-AMF breaks php date(..) function

2009-10-01 Thread MSFXX

I would like to create a date variable like this:

$thedate = date(d-m);

outputting something like 01-10

This works fine within my PHP class however when I use it within the
ZendFramework it breaks :(

There is nothing wrong with the other code within the class because if I
hardcode the date to:

$thedate = 01-10;

then it all works fine when using the Zend Framework so the call to
date(d-m) is breaking my class... anyone know why? :(
-- 
View this message in context: 
http://www.nabble.com/Zend-AMF-breaks-php-date%28..%29-function-tp25696851p25696851.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend-AMF breaks php date(..) function

2009-10-01 Thread Alan Wagstaff
What error messages do you get when you use date()?

2009/10/1 MSFXX m...@msfx.co.uk


 I would like to create a date variable like this:

 $thedate = date(d-m);

 outputting something like 01-10

 This works fine within my PHP class however when I use it within the
 ZendFramework it breaks :(

 There is nothing wrong with the other code within the class because if I
 hardcode the date to:

 $thedate = 01-10;

 then it all works fine when using the Zend Framework so the call to
 date(d-m) is breaking my class... anyone know why? :(
 --
 View this message in context:
 http://www.nabble.com/Zend-AMF-breaks-php-date%28..%29-function-tp25696851p25696851.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] 2D Barcode generation (e.g. DataMatrix ECC200)

2009-10-01 Thread Gunter Sammet
Hi all:
I'm in the need of generating 2D barcode (DataMatrix ECC200 for shipping
labels). So far I haven't found anything open source that would allow me to
create them. So I thought it might be a good addition to ZF. Checked if
there is already any barcode project in ZF and I found the following:

http://framework.zend.com/wiki/pages/viewpage.action?pageId=43220
svn://mikaelkael.dyndns.org/barcode

Haven't checked out the code yet. Will do so ASAP.

Not sure how much work it would be, to get 2D barcodes integrated. Any
thoughts and pointers would be appreciated.

Thanks,

Gunter

PS: So far I have only found commercial software for 2D barcodes. This would
be my current pick if I have to buy something:
http://www.aditus.nu/jpgraph/proversion.php (Professional version of
jpgraph).


Re: [fw-general] Autoloading Doctrine models/base models

2009-10-01 Thread Matthew Weier O'Phinney
-- Dodger glen...@gmail.com wrote
(on Wednesday, 30 September 2009, 12:14 PM -0700):
 File NameClass PrefixBase Prefix Model Name
 --
 Post.php Blog_Model_ Post
 (Blog_Model_Post)
 BasePost.php Blog_Model_ BasePost
 (Blog_Model_BasePost)
 
 But for ZF resource/module autoloading to work, the base class needs to be in 
 a
 different namespace (because it's in a different directory, and you can't
 specify two directories to look in for a single namespace). So I actually need
 to have a different class prefix for base classes. Perhaps something like:
 
 File NameClass PrefixBase Prefix Model Name
 --
 Post.php Blog_Model_ Post
 (Blog_Model_Post)
 BasePost.php Blog_BaseModel_ BasePost
 (Blog_BaseModel_BasePost)
 
 ... but it's not possible to specify a different class prefix for base classes
 in Doctrine! (when using the code generation tools)
 
 I'm not sure how to do this. The ZF resource/module autoloaders seem rather
 inflexible.
 
 D.
 
 P.S. The models are stored in application/modules/blog/models (and /models/
 generated for base models)

It's actually really easy:

$al = Zend_Loader_Autoloader::getInstance();
$al-registerNamespace('Doctrine');
$al-pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine_');

You also have to tell Doctrine it should autoload models:

$manager-setAttribute(Doctrine::ATTR_MODEL_LOADING, 
Doctrine::MODEL_LOADING_CONSERVATIVE);
$manager-setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);

and your table classes need to be in the same directory as your models
themselves:

blog/
models/
Post.php
PostTable.php

Then use a resource autoloader or module autoloader to do autoloading of
your model classes; everything at this point will work.

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/


Re: [fw-general] Autoloading Doctrine models/base models

2009-10-01 Thread Dodger

Hi Matthew,

Yes, I read that info in your blog. Unfortunately, my requirements differ.

1. At the moment, I'm not using table classes.
2. I need generated base classes to be autoloaded.

You say: Then use a resource autoloader or module autoloader to do
autoloading of
your model classes; everything at this point will work. -- but isn't that
the reason for enabling Doctrine autoloading? Why do it twice?

Also, according to the Doctrine documentation, Conservative model loading
requires that each file contain only one class, and the file must be named
after the class. For example, if you have a class named User, it must be
contained in a file named User.php. -- which would mean that the file name
would have to be Blog_Model_Post.php, which is a bit long and ugly.

Shouldn't the Zend resource/module autoloaders allow you to specify more
than one folder for classes? Like:

'model' = array(
'paths' = array('models/', 'models/generated/'),
'namespace' = 'Blog_Model'
)

Or, you could enable searching in subdirectries:

'model' = array(
'path' = 'models/',
'includeSubdirectories' = true,
'namespace' = 'Blog_Model'
)

Thoughts?

D.


Matthew Weier O'Phinney-3 wrote:
 
 -- Dodger glen...@gmail.com wrote
 (on Wednesday, 30 September 2009, 12:14 PM -0700):
 File NameClass PrefixBase Prefix Model Name
 --
 Post.php Blog_Model_ Post   
 (Blog_Model_Post)
 BasePost.php Blog_Model_ BasePost   
 (Blog_Model_BasePost)
 
 But for ZF resource/module autoloading to work, the base class needs to
 be in a
 different namespace (because it's in a different directory, and you
 can't
 specify two directories to look in for a single namespace). So I actually
 need
 to have a different class prefix for base classes. Perhaps something
 like:
 
 File NameClass PrefixBase Prefix Model Name
 --
 Post.php Blog_Model_ Post   
 (Blog_Model_Post)
 BasePost.php Blog_BaseModel_ BasePost   
 (Blog_BaseModel_BasePost)
 
 ... but it's not possible to specify a different class prefix for base
 classes
 in Doctrine! (when using the code generation tools)
 
 I'm not sure how to do this. The ZF resource/module autoloaders seem
 rather
 inflexible.
 
 D.
 
 P.S. The models are stored in application/modules/blog/models (and
 /models/
 generated for base models)
 
 It's actually really easy:
 
 $al = Zend_Loader_Autoloader::getInstance();
 $al-registerNamespace('Doctrine');
 $al-pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine_');
 
 You also have to tell Doctrine it should autoload models:
 
 $manager-setAttribute(Doctrine::ATTR_MODEL_LOADING,
 Doctrine::MODEL_LOADING_CONSERVATIVE);
 $manager-setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
 
 and your table classes need to be in the same directory as your models
 themselves:
 
 blog/
 models/
 Post.php
 PostTable.php
 
 Then use a resource autoloader or module autoloader to do autoloading of
 your model classes; everything at this point will work.
 
 -- 
 Matthew Weier O'Phinney
 Project Lead| matt...@zend.com
 Zend Framework  | http://framework.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/Autoloading-Doctrine-models-base-models-tp25687101p25706039.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Problem with autoloading and unit testing Zend_Application

2009-10-01 Thread Ralph Schindler
Mostly you should note that just as your application would bootstrap, so 
does your testing environment.


This means that you need to have an Zend_Application being setup, and it 
would bootstrap as normal.  This would assume that your bootstrap class 
probably has a method to setup your autoloading too.


http://maff.ailoo.net/2009/04/set-up-a-zend-framework-application-using-zend_application-including-phpunit-setup/#add-unit-testing

Let me know if that link gets you going,
Ralph

Aycko wrote:

Push.


Aycko wrote:

All classes which are loaded with Zend_Application_Module_Autoloader in
module bootrap could not be found. The autoloaders are defined in
application bootstrap and module bootstrap ... this works great, but not
fpr testing.
Defining the Zend_Application_Module_Autoloaders in bootstrap file in
tests folder dont works. Including the missing miles via require_once
works, but this is not very comfortable.


funkyfly wrote:

Can you provide more detailed information about the fatal error?
--
Regards,
Vladas Diržys


On Fri, Sep 25, 2009 at 13:18, Aycko aycko.maer...@gmx.de wrote:




Aycko wrote:

Hello together,

i set up a basic environment for unit testing my Zend_Application.

A basic test looks something like this:

public function testDefaultControllerAndAction() {
$this-dispatch('/');
$this-assertController('index');
$this-assertAction('index');
}

Calling phpunit in command line causes some php fatal errors. All

classes

which are loaded with Zend_Application_Module_Autoloader in module

bootrap

could not be found.

Are there any solution without setting up all requires manually?


Best regards
Aycko


Any ideas?
--
View this message in context:
http://www.nabble.com/Problem-with-autoloading-and-unit-testing-Zend_Application-tp25534200p25609668.html
Sent from the Zend Framework mailing list archive at Nabble.com.