[fw-general] Re: zf2 tests can't load ./vendor modules

2013-06-18 Thread Katalin
QUOTE:
Hi,

Any update on this?

I am facing the same problems.  I can load Doctrine from the regular app but
when trying to do it from the tests folder (inside one of my modules) it
gives the same error message.

- mario

Hi, I did figure out a ugly way to get it working. It works for me. Maybe
you can get something good, or even the idea from there: http://goo.gl/JkNYt
. 



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zf2-tests-can-t-load-vendor-modules-tp4659745p4660354.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




[fw-general] Re: DateStepTest taking too long

2013-04-29 Thread Katalin
php 5.4 ubuntu zf2 2.1.16-dev, no exotic extensions.
The thing is he has to add EVERY second from 1970 to 2010 and ofc that's
expensive use of CPU.



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/DateStepTest-taking-too-long-tp4659870p4659876.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




[fw-general] DateStepTest taking too long

2013-04-29 Thread Katalin
Hi!
In DateStepTest.php if I test for a long time period between two dates by a
small step, it takes lots of time to compute it (1m). But it works.
Would be great if someone would like to make it better. Im too bad :)


DateStepTest.php: 
https://github.com/zendframework/zf2/blob/master/tests/ZendTest/Validator/DateStepTest.php
My test:
https://github.com/screws0ft/zf2/commit/474f89f321b380dc935ff33e3cfbbfcd0286bf47



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/DateStepTest-taking-too-long-tp4659870.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




[fw-general] Re: Zend\Form\Element\DateTime problem with data format

2013-04-28 Thread Katalin
Here it is guys:
The error: Fatal error: Maximum execution time of 30 seconds exceeded in
/vendor/zendframework/zendframework/library/Zend/Validator/DateStep.php
on line 350.

setApplicationConfig(
include '/config/test/application.config.php'
);
parent::setUp();
  }
  public function testShouldPass()
  {
//create a fieldset
$form = new \Zend\Form\Form();
$formInputFilter = new \Zend\InputFilter\InputFilter();

//create elements
$post_date = new \Zend\Form\Element\DateTime('post_date');
$post_date
  ->setLabel('Form_AddBlogPost_PostDateLabel')
  ->setAttributes(array(
//'min'  => '2010-01-01T00:00:00Z',
//'max'  => '2020-01-01T00:00:00Z',
//'step' => '1', // minutes; default step interval is 1 min
  ));
$post_date->setFormat("Y-m-d H:i:s");
$form->add($post_date);


//create filters
$post_dateFilter = new \Zend\InputFilter\Input('post_date');
$post_dateFilter ->getValidatorChain()
   ->addValidator(new \Zend\Validator\Date("Y-m-d H:i:s"));
$formInputFilter->add($post_dateFilter);
$form->setInputFilter($formInputFilter);

//simulate a request
$postData = new \Zend\Stdlib\Parameters(array(
  'post_date' => "2013-04-28 21:11:52"
));
$request = new \Zend\Http\Request();
$request->setPost($postData);

$form->setData($request->getPost());

$this->assertTrue($form->isValid());
  }
}



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-DateTime-problem-with-data-format-tp4657657p4659863.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




[fw-general] Re: How to Validate Backlink

2013-04-28 Thread Katalin
Do a CURL request for the page, parse it with Dom\Query and select all
anchors from that page. That would be the css3-like format. e.g.: "a".
Afterwards, you filter each anchor by selecting only those who have "href"
set to your page. If there is any, you got your backlink!

Here is a implementation for it:
https://github.com/blanchonvincent/zf2/blob/master/library/Zend/Test/PHPUnit/Controller/AbstractHttpControllerTestCase.php#L298-340

Here is a simple use of it:
public function testHomeUriShouldDisplayA404ErrorMessage()
{
$this->dispatch('/');
$found = false;
foreach($this->queryDOM('*') as $node)
if(strpos($node->nodeValue, "404") !== false)
$found = true;
$this->assertTrue($found, "A 404 message couldn't be found in 
Application
module");
}



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-to-Validate-Backlink-tp4659841p4659862.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




[fw-general] Re: Zend\Form\Element\DateTime problem with data format

2013-04-28 Thread Katalin
I confirm. I'll try making some tests to DateStep.



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-DateTime-problem-with-data-format-tp4657657p4659861.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




[fw-general] Edit documentation form radio

2013-04-28 Thread Katalin
Hello!
I spotted an error here:
http://framework.zend.com/manual/2.0/en/modules/zend.form.elements.html#radio
In 2.1.6, its:
 use Zend\Form\Element;
 use Zend\Form\Form;

 $radio = new Element\Radio('gender');
 $radio->setLabel('What is your gender ?');
 $radio->setValueOptions(array(
 '0' => 'Female',
 '1' => 'Male',
 ));

 $form = new Form('my-form');
 $form->add($radio);

I tried searching for the black box in left bottom to edit it on github, but
couldn't find it. :)
Hope it helps some minutes to somebody sometime.
Thank you



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Edit-documentation-form-radio-tp4659860.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




[fw-general] Re: Zf2 still supports getDependencies ?

2013-04-27 Thread Katalin
I see. The function changed to "getModuleDependencies" from
"getDependencies". It seems reduntant the keywords "Module", but for anyone
trying to put dependencies, here is a sample code:

getApplication()->getServiceManager()->get('translator');
$eventManager= $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}

public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
/**
* Get dependencies
*
* @return array
*/
public function getModuleDependencies() // @TODO: is it working?
{
   return array(
   'Application',
   'ZfcUserDoctrineORM'
   );
}
}

Thank you!



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zf2-still-supports-getDependencies-tp4659852p4659855.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




[fw-general] Zf2 still supports getDependencies ?

2013-04-27 Thread Katalin
There is no "getDependencies" call:
https://github.com/search?q=getDependencies+%40zendframework%2Fzf2&type=Code

So, before that I tried to find some code for adding dependencies to
modules, and I found this:
http://stackoverflow.com/questions/10796180/advises-needed-on-zend-framework-2-modules-and-models-architecture
. Added some dependencies, disabled some modules and the project didnt work.
But it didn't didn't work for "Cant load module X" but "Can't find class X".
So, I understand most of the people work with composer, but on large
projects it would be GREAT and maybe a requirement this thingy. Why was it
removed?
Thank you



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zf2-still-supports-getDependencies-tp4659852.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




[fw-general] Re: zf2 tests can't load ./vendor modules

2013-04-17 Thread Katalin
It's not a doctrineorm autoloader error. As I said, the first module that
tries to load and is not from "modules", it crashes.

Marco Pivetta wrote
> DoctrineModule does not support autoloading without composer anymore. You
> may want to require the composer autoloader in your Bootstrap.php :)
> 
> Marco Pivetta
> 
> http://twitter.com/Ocramius
> 
> http://ocramius.github.com/
> 
> 
> On 17 April 2013 18:29, Katalin [via Zend Framework Community] <

> ml-node+s634137n4659747h77@.nabble

>> wrote:
> 
>> Forgot to mention i tried that way.
>>
>> Fatal error: Uncaught exception
>> 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module
>> (DoctrineModule) could not be initialized.' in
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:140
>>
>> Stack trace:
>> #0
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(81):
>> Zend\ModuleManager\ModuleManager->loadModule('DoctrineModule')
>> #1 [internal function]:
>> Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
>>
>> #2
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(472):
>> call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
>> #3
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207):
>> Zend\EventManager\EventManager->triggerListeners('loadModules',
>> Object(Zend\ModuleManager\ModuleEvent), NULL)
>> #4
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(100):
>> Zend\EventManager\EventManager->trigger('loadModules', Object(Ze in
>> Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php
>> on line 140
>>
>>
>> But say I change
>> 'modules' => array(
>> 'BjyProfiler',
>> 'ZendDeveloperTools',
>> 'DoctrineModule',
>> 'DoctrineORMModule',
>> 'ZfcBase',
>> 'ZfcUser',
>> 'ZfcUserDoctrineORM',
>> 'Application',
>> 'Blog',
>> ),
>>
>> to
>>
>> 'modules' => array(
>> 'ZfcBase',
>> 'BjyProfiler',
>> 'ZendDeveloperTools',
>> 'DoctrineModule',
>> 'DoctrineORMModule',
>> 'ZfcUser',
>> 'ZfcUserDoctrineORM',
>>     'Application',
>> 'Blog',
>> ),
>>
>> Then the error is not about Doctrine, is about ZfcBase (the first module
>> that needs load from ./vendor).
>>
>> config:
>> https://github.com/screws0ft/fz/blob/master/module/Blog/tests/config/test/application.config.php
>>
>>
>> Marco Pivetta wrote
>> You may want to check
>>
>> http://stackoverflow.com/questions/14768621/zend-framework-2-tutorial-module-application-could-not-be-initialized
>>
>> Also: what is the exact exception?
>>
>> Marco Pivetta
>>
>> http://twitter.com/Ocramius
>>
>> http://ocramius.github.com/
>>
>>
>> On 17 April 2013 18:09, Katalin [via Zend Framework Community] <
>> [hidden email]
>> <http://user/SendEmail.jtp?type=node&node=4659747&i=0>;>
>> wrote:
>>
>> > Hi
>> > I did some tests, created the module Blog, did some more tests and it
>> all
>> > passed. I had to add doctrine to the module Blog and now i need more
>> tests.
>> > My config.php for BlogTests seems to be okey - all directories exists,
>> even
>> > "vendor" but the autoloader seems it doesn't load the module
>> > DoctrineORMModule. The problem actually is it doesn't load even a
>> single
>> > module from "vendor", anyway I can priorities them in "'modules' =>
>> > array(". Is there some kind of problem from autoloader caused by
>> composer?
>> > Here are the tests:
>> > https://github.com/screws0ft/fz/tree/master/module/Blog/tests
>> > Thank you
>> >
>> > --
>> >  If you reply to this email, your message will be added to the
>> discussion
>> > below:
>> >
>

[fw-general] Re: zf2 tests can't load ./vendor modules

2013-04-17 Thread Katalin
Forgot to mention i tried that way.

Fatal error: Uncaught exception
'Zend\ModuleManager\Exception\RuntimeException' with message 'Module
(DoctrineModule) could not be initialized.' in
Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:140
Stack trace:
#0
Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(81):
Zend\ModuleManager\ModuleManager->loadModule('DoctrineModule')
#1 [internal function]:
Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#2
Z:\fz\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(472):
call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#3
Z:\fz\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('loadModules',
Object(Zend\ModuleManager\ModuleEvent), NULL)
#4
Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(100):
Zend\EventManager\EventManager->trigger('loadModules', Object(Ze in
Z:\fz\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php
on line 140


But say I change 
'modules' => array(
'BjyProfiler',
'ZendDeveloperTools',
'DoctrineModule',
'DoctrineORMModule',
'ZfcBase',
'ZfcUser',
'ZfcUserDoctrineORM',
'Application',
'Blog',
),

to

'modules' => array(
'ZfcBase',
'BjyProfiler',
'ZendDeveloperTools',
'DoctrineModule',
'DoctrineORMModule',
'ZfcUser',
'ZfcUserDoctrineORM',
'Application',
'Blog',
),

Then the error is not about Doctrine, is about ZfcBase (the first module
that needs load from ./vendor).

config:
https://github.com/screws0ft/fz/blob/master/module/Blog/tests/config/test/application.config.php



Marco Pivetta wrote
> You may want to check
> http://stackoverflow.com/questions/14768621/zend-framework-2-tutorial-module-application-could-not-be-initialized
> 
> Also: what is the exact exception?
> 
> Marco Pivetta
> 
> http://twitter.com/Ocramius
> 
> http://ocramius.github.com/
> 
> 
> On 17 April 2013 18:09, Katalin [via Zend Framework Community] <

> ml-node+s634137n4659745h15@.nabble

>> wrote:
> 
>> Hi
>> I did some tests, created the module Blog, did some more tests and it all
>> passed. I had to add doctrine to the module Blog and now i need more
>> tests.
>> My config.php for BlogTests seems to be okey - all directories exists,
>> even
>> "vendor" but the autoloader seems it doesn't load the module
>> DoctrineORMModule. The problem actually is it doesn't load even a single
>> module from "vendor", anyway I can priorities them in "'modules' =>
>> array(". Is there some kind of problem from autoloader caused by
>> composer?
>> Here are the tests:
>> https://github.com/screws0ft/fz/tree/master/module/Blog/tests
>> Thank you
>>
>> --
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://zend-framework-community.634137.n4.nabble.com/zf2-tests-can-t-load-vendor-modules-tp4659745.html
>>  To start a new topic under Zend Framework, email
>> 

> ml-node+s634137n634138h98@.nabble

>> To unsubscribe from Zend Framework Community, click
>> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>;
>> .
>> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>;
>>





--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zf2-tests-can-t-load-vendor-modules-tp4659745p4659747.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




[fw-general] zf2 tests can't load ./vendor modules

2013-04-17 Thread Katalin
Hi
I did some tests, created the module Blog, did some more tests and it all
passed. I had to add doctrine to the module Blog and now i need more tests.
My config.php for BlogTests seems to be okey - all directories exists, even
"vendor" but the autoloader seems it doesn't load the module
DoctrineORMModule. The problem actually is it doesn't load even a single
module from "vendor", anyway I can priorities them in "'modules' => array(".
Is there some kind of problem from autoloader caused by composer?
Here are the tests:
https://github.com/screws0ft/fz/tree/master/module/Blog/tests
Thank you



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zf2-tests-can-t-load-vendor-modules-tp4659745.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




[fw-general] Doctrine zf2 tests Marco Pivetta

2013-04-16 Thread Katalin
Hi!
Not a long time ago i found out about mock objects. Would be great if I
could implement them too. The code I came up with untill now (which
obviously fails) is:
mock = $this->getMock("Blog\Entity\Post", 
array('persist',
'flush'));
}
public function testCanInsertBlogEntry()
{
$this->mock->user_id = 1;
$this->mock->cat_id = 1;
$this->mock->title = "lol";
$this->mock->adress = "lol";
$this->mock->post_date = new \DateTime('now');
$this->mock->allow_comments = true;

$this->assertEquals($this->mock->persist(), true);
}
public function testBlogPostEntityShouldExist()
{

}
}

The "Blog\Entity\Post" is loaded correctly, but I don't have the persist
method into it. So, how do I save it somewhere to simulate a real database?
I would like to access some methods who create a new record with say a param
"name" set to "x", and then test if it was created successfully by finding
the "name" => "x". Should I retrieve the mock 'Doctrine\ORM\EntityManager' ?
Really appreciate.
Great tut, btw. http://marco-pivetta.com/doctrine-orm-zf2-tutorial/




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Doctrine-zf2-tests-Marco-Pivetta-tp4659730.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




[fw-general] Re: Zend Framework 2 - Unit Tests

2013-02-28 Thread Katalin
<http://zend-framework-community.634137.n4.nabble.com/file/n4659376/308wu12.jpg>
 

One more thing if u don't mind.
I get plenty of errors per test, and some strange milisecond times. Are them
function calls? Is it my configuration why are tests that don't pass? Or,
being development code, it's okey? I just wanna know if it's from me.

Also, by `ant` are you refering to Apache Ant ?

Katalin



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-Unit-Tests-tp4659372p4659376.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




[fw-general] Re: Zend Framework 2 - Unit Tests

2013-02-28 Thread Katalin
No, definetly not trolling. Ever. Uncle bob is an cleancoders guy.
I had no tests. I searched them, tried to find them in anyway possible, and
i failed.
Thanks for "--dev", now I have "tests" folder.
Katalin



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-Unit-Tests-tp4659372p4659374.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




[fw-general] Zend Framework 2 - Unit Tests

2013-02-28 Thread Katalin
Hello World.
Are there any unit tests for zf2? Where are they kept? Uncle Bob just teach
me how important are those unit tests. Seems like all my questions about zf2
framework would be solved just by copy-pasteing code from unit tests.
Thank you very much :)



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-Unit-Tests-tp4659372.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




[fw-general] Re: Don't display layout if ajax request

2013-02-13 Thread Katalin
Here it is:
Thank you

Module.php
---
http://framework.zend.com/)
 *
 * @link  http://github.com/zendframework/ZendSkeletonApplication for 
the
canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc.
(http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
use Zend\EventManager\EventInterface;
//@TODO: $message = $this->getRequest()->query()->get('message', 'foo');
class Module
{
public function onBootstrap(MvcEvent $e)
{
//..
$em = $e->getApplication()->getEventManager();
$em->attach(\Zend\Mvc\MvcEvent::EVENT_DISPATCH, array($this,
'onDispatch'));
 }

public function onDispatch(\Zend\Mvc\MvcEvent $e)
{
$app = $e->getParam('application'); 
$layout = $app->getMvcEvent()->getViewModel(); 
if( $app->getRequest()->isXmlHttpRequest() ) 
{
$controller = $e->getTarget();
$controller->layout('layout/empty');
$layout->setTerminal(true);
}
}
//..
}
---

/view/layout/empty.phtml
---
content; ?>
---



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Don-t-display-layout-if-ajax-request-tp4659147p4659154.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




[fw-general] Re: Don't display layout if ajax request

2013-02-13 Thread Katalin
Hi
I changed the code to:
---
namespace Application; 

use Zend\Mvc\ModuleRouteListener; 
use Zend\Mvc\MvcEvent; 
use Zend\EventManager\EventInterface; 

class Module 
{ 
//.. 

public function onBootstrap(EventInterface $event) 
{ 
$app = $event->getParam('application'); 
$layout = $app->getMvcEvent()->getViewModel(); 
if( $app->getRequest()->isXmlHttpRequest() ) 
{ 
var_dump($layout->setTerminal(true)); 
} 
} 
}
---

The if works, and the layout should be terminated, but it doesn't work.
pic: 

 



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Don-t-display-layout-if-ajax-request-tp4659147p4659151.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




[fw-general] Re: Don't display layout if ajax request

2013-02-13 Thread Katalin
Hi. I have plenty of modules and actions. You solution doesn't fit.



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Don-t-display-layout-if-ajax-request-tp4659147p4659149.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




[fw-general] Don't display layout if ajax request

2013-02-13 Thread Katalin
Hi. Could someone help me with this? I am noob and can't understand the
events, and how to get resources..
This is my Module.php

---
getParam('application');
$sm  = $app->getServiceManager();


//$this->bootstrap('layout');

$layout = $this->getResource('layout');
$view = $layout->getView();

if( $this->getRequest()->isXmlHttpRequest() )
{
$layout->setTerminal(true);
}
}
}
---
Thank you 



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Don-t-display-layout-if-ajax-request-tp4659147.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




[fw-general] Zend Framework 2 WebSockets

2013-02-06 Thread Katalin
Hi!
Does some one have a piece of code for websockets implemented in zend
framework 2?

I would like to make a script for that, but I can't figure out how to
translate a piece of code, from zf1 into zf2. Basically what it used to do
is it accesed an action from a controller with some data (internally). And I
could have accessed all kinds of things, like:vars, the output template, and
plenty of things.. getVars and setVars were implemented by me because I
didn't know how to set POST and POST vars for a request.
Here it comes:
bootstrap()
;#->run();

$options = array(
'action' => 'index'
,'controller' => 'index'
,'module' => 'default'
);
$frontController = Zend_Controller_Front::getInstance ()->returnResponse (
true );


for($i = 0; $i < 100; $i++)
{
$r = dispatch(array($options['controller'], $options['module'],
$options['action']), array('user_id' => $i%2 == 0 ? 1 : 2));
}


/**
 * 
 * @param array $options
 * [0] = controller
 * [1] = module
 * [2] = action
 * @param unknown_type $params
 */
function dispatch(array $options, array $params)
{
global $frontController;



$request = new Zend_Controller_Request_Http ();

$request->setModuleName($options[1])->setActionName($options[2])->setControllerName($options[0])
->setParams($params);


$response = new Zend_Controller_Response_Http ();

$frontController->getDispatcher ()->dispatch ( $request, $response );

return $response->getVars();


}






Big thanks!



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-WebSockets-tp4659055.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