[fw-general] Framework or component library?

2010-02-14 Thread Mike A
Excuse potentially dumb questions first thing in the week (and for the Chinese, 
new year)...

Zend Framework is the badge given to what we use. When it comes to explaining 
things, 
especially novices, it seems difficult to describe where the ZF itself stops 
and the component 
library begins.

Is the ZF in fact a very small core and the component libray separate from it? 
If so, why not 
brand separately to distinguish in the minds of those entering "ZF" where the 
core ends and 
"extras" begin? Are there references to answer these questions?

This all relates to a book I am writing and students I assist.

TIA...

Mike A.


Re: [fw-general] Re: Zend_Translate with TMX: what's the proper usage?

2010-02-14 Thread Thomas Weidner

And one more question - i noticed that the translations for validation
messages described
http://zendframework.com/manual/en/zend.validate.messages.html#zend.validate.messages.pretranslated
in the reference here  were finaly included in the 1.10.1 distribution.
Still the russian translation is missing - would you like any help with
that?


Until now there were 4 people (or comunities) which said that they will add 
the resources for russian.
But until now, after 4 weeks where I wrote my blog, still no one has done 
this.


So actually resources only cover english, german, french, netherland and 
brasil.

No other languages have been done by the community for now.
When other resources are translated by the community, then they should add 
the file to a new ticket so we can add it to trunk.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com 



[fw-general] Public ZF repository with require_once calls excluded

2010-02-14 Thread Steven Brown
Does anyone know of any public ZF repositories that have the require_once
calls commented out or removed?

 

I use these in every project to improve performance by using lazy loading.

 

Would the ZF team object to me creating one? Would this violate the license?

 

Cheers,
Steven



Re: [fw-general] Struggling with Resource Autoloading

2010-02-14 Thread Victor Farazdagi

Andrea,
First of - stuff you are trying to auto-load is pretty standard, so I'd 
use Zend_Application_Module_Autoloader instead (check out its source 
code - it loads models, services etc).

So, having following Bootstrap.php is enough:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
   public function _initAutoload()
   {
   $moduleLoader = new Zend_Application_Module_Autoloader(
   array('namespace' => '', 'basePath' => APPLICATION_PATH)
   );
   return $moduleLoader;
   }
}

(note: you'd need My for namespace, for me it's ok to rely on 
appnamespace from configs/application.ini). Btw, check out the 
appnamespace in your application.ini - if you generated your project 
with zf - default value is "Application", which with my empty namespace 
above gives me Application_Service_SomeService classes.


Second, you autoloader resource seems ok syntax and usage-wise - 
autoloader namespace (My) gets appended with resource name (say, 
Service), so it My_Service_SomeService should resolve..in theory :)
If issue is not with appnamespace, can you post your full Bootstrap.php, 
and your index.php, so that resource init can be reviewed in context?


Andrea Turso wrote:

Hi people, I'm struggling to make Resource Autoloading work with
Zend Framework 1.10.0

I created a blank project and started putting some code inside a controller
created all the needed classes and configured my resources.

The application directory structure is pretty standard:

application/
`· services/
`· models/
`· controllers/

The index.php is the one generated by Zend_Tool.
I added these line in my application Bootstra.php

new Zend_Loader_Autoloader_Resource(
array(
'basePath'  => APPLICATION_PATH,
'namespace' => 'My',
'resourceTypes' => array(
'service' => array(
'path' => 'services',
'namespace' => 'Service',
),
'model' => array(
'path' => 'models',
'namespace' => 'Model',
),
),
)
);

But when I run the application from my browser it keeps spitting out a
fatal error
because it can't find the My_Service_SomeService class.

Warning: Zend_Loader::include_once(My/Service/SomeService.php) [...]
/Development/Zend/Loader.php on line 146

Fatal error: Class 'My_Service_SomeService' not found in
/home/trashofmasters/Development/my/application/controllers/IndexController.php
on line 46

Ah, what a hell of headache... I always struggled with this damned
autoloaders lol.

Any suggestions? Searching in the mailing lists didn't seem to give
interesting results.

Thanks in advance,
Andrea

  



--
Victor Farazdagi

Blog  | http://www.phpmag.ru
FourSee   | http://www.4cinc.com
UMapper   | http://www.umapper.com




[fw-general] Struggling with Resource Autoloading

2010-02-14 Thread Andrea Turso
Hi people, I'm struggling to make Resource Autoloading work with
Zend Framework 1.10.0

I created a blank project and started putting some code inside a controller
created all the needed classes and configured my resources.

The application directory structure is pretty standard:

application/
`· services/
`· models/
`· controllers/

The index.php is the one generated by Zend_Tool.
I added these line in my application Bootstra.php

new Zend_Loader_Autoloader_Resource(
array(
'basePath'  => APPLICATION_PATH,
'namespace' => 'My',
'resourceTypes' => array(
'service' => array(
'path' => 'services',
'namespace' => 'Service',
),
'model' => array(
'path' => 'models',
'namespace' => 'Model',
),
),
)
);

But when I run the application from my browser it keeps spitting out a
fatal error
because it can't find the My_Service_SomeService class.

Warning: Zend_Loader::include_once(My/Service/SomeService.php) [...]
/Development/Zend/Loader.php on line 146

Fatal error: Class 'My_Service_SomeService' not found in
/home/trashofmasters/Development/my/application/controllers/IndexController.php
on line 46

Ah, what a hell of headache... I always struggled with this damned
autoloaders lol.

Any suggestions? Searching in the mailing lists didn't seem to give
interesting results.

Thanks in advance,
Andrea


[fw-general] Several issues for Zend_Tool 1.10

2010-02-14 Thread Jurian Sluiman
Hi all,
I'm having several problems with Zend_Tool now I updated to the 1.10 series
(from 1.9.7 to 1.10.1). It seems there are several BC breaks, but none of
them are listed in the changelog (1.10.0 nor 1.10.1).

First of all, it's a new config which you must enable first. zf create
config && zf enable config.manifest Zend_Tool_Project_Provider_Manifest did
the trick for the Zend_Tool_Project providers. The same way I could enable
my own providers. The documentation doesn't say anything about this, I'd to
read it from some bug reports. Is there an up to date documentation
available for Zend_Tool?

Also, my providers worked fine for the 1.9.7 release, but are broken at this
moment. I tried to find the bug, but it seemed impossible to do. The classes
are cached somewhere and zf ? doesn't show an option to clear the cache. I
removed the manifest from the config and enabled it again, but that didn't
help.

How can I use my own Zend_Tool providers again?
Thanks, Jurian


[fw-general] Patterns / Domain Model / Oop association

2010-02-14 Thread My Lists
Hello everyone, i just trying to find a way to project my business logic
with associated tables (models). Here i have a table that store my products
and another table in charge of control the items availability. I need this
table itemAvailability because i have business units in my app, so is
necessary to filter stocks qty for units.

Please check my following layers and tell me your opinion if something could
be better.

THE MAPPER

class Default_Model_ItemMapper
{

public function fetchAll()
{

$select=$this->getDbTable()->select()
->setIntegrityCheck(false)
//->from(array('s'=>'searchItems',array('item__id')))
->from(array('i'=>'item'))
->join(array('ia'=>'itemAvailability'),
'i.item__id=ia.item__id__FK'))
->where('ia.businessUnit__code__FK=?',//here by business unit code
(FK))
->order(array('i.item__fullName'));

 $this->_paginator = new Zend_Paginator(new
Zend_Paginator_Adapter_DbTableSelect($select));

 
$this->_paginator->setCurrentPageNumber(Zend_Controller_Front::getInstance()->getRequest()->getParam('page'));
 $this->_paginator->setItemCountPerPage(30);


foreach ($this->_paginator as $item__ROW)
{
$itemAvailability__MDL=new Default_Model_ItemAvailability();

$itemAvailability__MDL->setStockQty($item__ROW->itemAvailability__stockQty)//here
is my joined field feeding the ItemAvailability instance
;

$item__MDL = new Default_Model_Item();
$item__MDL->setId($item__ROW->item__id)
->setName($item__ROW->item__name)
->setFullName($item__ROW->item__fullName)
->setDescription($item__ROW->item__description)
->setGrossWeight($item__ROW->item__grossWeight)
->setItemAvailability__MDL($itemAvailability__MDL)// here is my
instance  (OOP/association) of Default_Model_ItemAvailability
;
$item__RWSIST[$item__ROW->item__id]=$item__MDL;
}

return $item__RWSIST;
}

public function getPaginator()
{
return $this->_paginator;
}


}

THE MODEL

class Default_Model_Item   extends Default_Model_Abstract
{

protected $_item__id;
protected $_item__name;
protected $_item__fullName;
protected $_item__description;
protected $_item__grossWeight;
protected $_item__tagHighlight;

protected $_itemAvailability__MDL;


//here __set and __get methods of Item instance


// here specially the method for setting and get my ItemAvailability
instance

public function setItemAvailability__MDL($value)
{
$this->$_itemAvailability__MDL =  $value;
return $this;
}

public function getItemAvailability__MDL()
{
return $this->$_itemAvailability__MDL;
}


public function isAvailable()
{
//here i do some logic with the self  Item instance and also with
the associatied ItemAvailability instance like:
if($this->$_itemAvailability__MDL->getStockty > 0)
//return ok(true) available for sale
}
 }

public function getPaginator()
{
 return $this->getMapper()->getPaginator();
}
}

THE CONTROLLER

And the in my controller i retrieve my items doing this:


class ItemController extends Zend_Controller_Action{

public function listAction()
{
$this->view->item__RWSIST=$this->_item__MDL->fetchAll();//HERE I
PASS the array with the instances for the view
$this->view->item__RWSPGT=$this->_item__MDL->getPaginator(); here i
pass the paginator

}
}

THE VIEW

Finally in my view (list.phtml i list the items:


paginationControl($this->item__RWSPGT,'Sliding','paginator_item.phtml');
?>


item__RWSPGT as $item__ROW):?>

//here i can use the logics of the Default_Model_Item



item__RWSIST[$item__ROW->item_id]->isAvailable()):?>//here is my
array with each one instance available for each item

here i show the buy button for example.







paginationControl($this->item__RWSPGT,'Sliding','paginator_item.phtml');
?>



What do you guys think of this approach? My domain model logic looks fine
for you? Or maybe i should use a service layer?
I just met Fowler's patterns and still trying to realize how to deal with
such patterns.I think in terms of OPP i can do this Classes/Objects
association but i dont know if im breaking any rule when my model is based
on Fowler's Domain Model.

Looking forward for comments please.

Thanks,
Eduardo


[fw-general] Re: Captcha decorator

2010-02-14 Thread dmitrybelyakov

Maybe some one will post a 'real' solution to this.

I'm gonna bookmark this topic because it seems to me that
Zend_Form_Element_Captcha does not allow you to use multiple HtmlTag
decorators on the element. It just uses the last one you set and ignores all
the rest.

Maybe you end up writing your own custom decorator to insert arbitrary
text/html and use it along wth HtmlTag. That may be a handy tool for other
strange cases.

Here's a link to Mattew explaining how to do 
http://devzone.zend.com/article/3450-Decorators-with-Zend_Form Decorators
with Zend_Form 


Hope this is of any help,
Dmitry.
-- 
View this message in context: 
http://n4.nabble.com/Captcha-decorator-tp1554698p1555110.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: Zend_Translate with TMX: what's the proper usage?

2010-02-14 Thread dmitrybelyakov


Thomas Weidner wrote:
> 
> Or set the "useId" option to false.
> In this case the source language is used as message key and the source
> must 
> be set as first translation.
> 
> 
> 
> segtype="sentence"
>adminlang="en-us" srclang="de-at" o-tmf="abc"
>creationtool="XYZTool" >
>
>
>
>Nachricht 1
>message 1
>
> -
> $translate = new Zend_Translate('tmx', $file, $locale, array('useId' => 
> false));
> 
> Then "Nachricht 1" will be used as message key instead of "0001".
> Note that this works only as with 1.10.2 (or trunk).
> 
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
> 

Hi Thomas!

That looks good. I'm glad this feature was added it will make the
translations look more clean.
I think i go udate now from the trunk. 

And one more question - i noticed that the translations for validation
messages described 
http://zendframework.com/manual/en/zend.validate.messages.html#zend.validate.messages.pretranslated
in the reference here  were finaly included in the 1.10.1 distribution.
Still the russian translation is missing - would you like any help with
that?

Dmitry.
-- 
View this message in context: 
http://n4.nabble.com/Zend-Translate-with-TMX-what-s-the-proper-usage-tp1471388p1555082.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] automation in converting date formats

2010-02-14 Thread WebCorp s . r . o . | Jan Juříček
Hello,

 

I've been trying to convert localized date values  (dd.MM.) gathered by
my form, to a format I can use in MySQL diabase (-MM-dd). I have been
able to extract my date parts successfuly, although that's not so much
success for me: the LocalizedToNormalized filter populates the form value
with an array, not a string. So I have following:

 

array(3) {

  ["show_since"] => array(5) {

["date_format"] => string(8) "d.M."

["locale"] => string(2) "cs"

["day"] => string(1) "2"

["month"] => string(1) "2"

["year"] => string(4) "2010"

  }

}

 

My intention is to pass the array returned by Zend_Form::getValues()
directly to the Zend_Db_Table::insert(), which is blocked by the fact, that
I have an array in the "show_since" field.

 

Is there a way, how to automate following scenario by default code?

 

1.   User inputs localized date

2.   User submits the form

3.   Form is being validated, $data = $form->getValues() is called

4.   $data variable is an array with one field named "show since",
containing a value in -MM-dd format

 

I have no trouble to write my own workaround, but I think this is very
common thing, so there should be a smart(er) way to do it

 

PS: yeah, this could be resolved by manual conversion in my mapper, but the
question remains: Is ZF capable of doing such conversion by itself?

 

Thanks all.

 

Jan



Re: [fw-general] Captcha decorator

2010-02-14 Thread Andrei Iarus
THe first problem is solved. The cause: the Captcha element does NOT need the 
ViewHelper decorator, because it adds the input text with the value=CaptchaID 

Anyway, the TR element doesn't get added:
 
$this->captcha->setDecorators( 
array( 
'Captcha', 
'Description', 
'Errors', 
array(array('dataX'=>'HtmlTag'), array('tag' => 'td')), 

array('Label', array('tag' => 'td')), 

array(array('row2'=>'HtmlTag'),array('tag'=>'tr')), 

) 
);
 
Could someone help me?



--- On Sun, 2/14/10, Andrei Iarus  wrote:


From: Andrei Iarus 
Subject: [fw-general] Captcha decorator
To: "Zend Framework" 
Date: Sunday, February 14, 2010, 12:26 AM







Hello to all, 
  
First question: why is ZF Captcha adding 2 input text elements? One contains 
already the ID, and the other is empty. One needs to write in both fields the 
correct value in order to be validated. 
Second question: I am trying to decorate my captcha element simply, as the 
other form elements: the label in a TD, the other parts in another TD, and all 
this in a tr. I use the same decorators for all form elements: 
  
$this->setElementDecorators( 
array( 
'ViewHelper', 
'Description', 
'Errors', 
array(array('data'=>'HtmlTag'), array('tag' => 'td')), 
array('Label', array('tag' => 'td')), 
array(array('row'=>'HtmlTag'),array('tag'=>'tr')) 

));
 
The problem: one of the text input element is not included in the td elements. 
Also no TR element is added. 
 
Thanks in advance.