[fw-general] Re: zend 2 ModuleRouteListener pratical example

2013-03-22 Thread whisher
whisher wrote
> 
> Marco Pivetta wrote
>> Heya!
>> 
>> The ModuleRouteListener (
>> https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/ModuleRouteListener.php)
>> prepends the module name to the requested controller name. That's
>> useful
>> if you want to use controller short names in routing :)
>> 
>> Marco Pivetta
>> 
>> http://twitter.com/Ocramius
>> 
>> http://ocramius.github.com/
>> 
>> 
>> On 17 March 2013 18:48, whisher [via Zend Framework Community] <

>> ml-node+s634137n4659503h13@.nabble

>>> wrote:
>> 
>>> Hi
>>> I can see in the module Application quick start:
>>> public function onBootstrap(MvcEvent $e)
>>> {
>>> $translator =
>>> $e->getApplication()->getServiceManager()->get('translator');
>>> $application = $e->getApplication();
>>> $eventManager  = $application->getEventManager();
>>> $moduleRouteListener = new ModuleRouteListener();
>>> $moduleRouteListener->attach($eventManager);
>>> }
>>> but I can't figure out the use or what's it for.
>>> Can you give a pratical exampkle or a short explanation, please ?
>>> Bye.
>>>
>>> --
>>>  If you reply to this email, your message will be added to the
>>> discussion
>>> below:
>>>
>>> http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503.html
>>>  To start a new topic under Zend Framework, email
>>> 

>> ml-node+s634137n634138h98@.nabble

>>> To unsubscribe from Zend Framework Community, click
>>> here;
>>> .
>>> NAML;
>>>
> Heya! 
> Thanks!
> :)

Sorry to bother you again but
http://stackoverflow.com/questions/13584136/same-controller-name-in-different-modules-in-zf2

  

I picked up the right breadcrumb :) ?




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zend-2-ModuleRouteListener-pratical-example-tp4659503p4659561.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




Re: [fw-general] Conditions in TableGateway JOIN ON clause

2013-03-22 Thread Brad Waite
The following function works:

public function fetchProducts() {
$products = new ProductsTable();
$expression = new \Zend\Db\Sql\Expression('i.ProductID = ' . 
$products->table . '.ItemID AND i.ItemID < 5');

$select = $this->products->getSql()->select();
$select->columns(array($select::SQL_STAR))
   ->join(array('i' => 'Items'), $expression, array(), 'left')
   ->where->isNull('i.ItemID')
   ->where->greaterThan('Qty', 0);

$newProducts = $products->selectWith($select);

return $newProducts;
}

Is there a mechanism for defining an alias for the TableGateway's table so that 
I could do something like this:

  $expression = new \Zend\Db\Sql\Expression('i.ProductID = p.ItemID AND 
i.ItemID < 5');

In other words, alias 'Products' to 'p' for use in the Expression.

Thanks,

-Brad

On 3/21/2013 5:58 PM, Brad Waite wrote:
> How do you use expressions in the ON clause of a JOIN with a TableGateway? In 
> the following code, the "5" is being
> quoted with brackets by the Sqlsrv adapter.
> 
> class ProductsTable extends AbstractTableGateway
> {
> protected $table = 'Products';
> }
> 
> 
> public function fetchProducts() {
> $products = new ProductsTable();
> $newProducts = $products->select(
> function (Select $select) {
> $select->join(
> array('i' => 'Items'),
> 'i.ProductID = Products.ItemID AND Products.ItemID < 5',
> $select::SQL_STAR,
> $select::JOIN_LEFT
> );
> 
> $select->where->isNull('i.ItemID');
> $select->where->greaterThan('Products.Qty', 0);
> });
> return $products;
> }
> 

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com