[fw-general] zend 2 key name in the config - best practise

2013-04-28 Thread whisher
Hi,
I'm starting naming like like this:
'controllers' = array(
'invokables' = array(
'mymodule_controller_base' =
'mymodule\Controller\BaseController',
'mymodule_controller_test' =
'mymodule\Controller\TestController'
),
),
'router' = array(
'routes' = array(
'mymodule_route' = array(
'type' = 'Zend\Mvc\Router\Http\Literal',
'options' = array(
'route'= '/',
'defaults' = array(
'controller' = 'mymodule_controller_base',
'action' = 'index',
),
),
),

I'm wondering if it is acceptable or not.
What's the best practise ?




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zend-2-key-name-in-the-config-best-practise-tp4659857.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 2 key name in the config - best practise

2013-04-28 Thread Marco Pivetta
This is documented under service names good practices at
http://framework.zend.com/manual/2.1/en/modules/zend.service-manager.quick-start.html

You can read some discussion about it on
https://github.com/zendframework/zf2-documentation/pull/692 and
http://stackoverflow.com/questions/15039144/what-is-the-sense-of-naming-invokables-like-classes

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 28 April 2013 11:18, whisher [via Zend Framework Community] 
ml-node+s634137n4659857...@n4.nabble.com wrote:

 Hi,
 I'm starting naming like like this:
 'controllers' = array(
 'invokables' = array(
 'mymodule_controller_base' =
 'mymodule\Controller\BaseController',
 'mymodule_controller_test' =
 'mymodule\Controller\TestController'
 ),
 ),
 'router' = array(
 'routes' = array(
 'mymodule_route' = array(
 'type' = 'Zend\Mvc\Router\Http\Literal',
 'options' = array(
 'route'= '/',
 'defaults' = array(
 'controller' = 'mymodule_controller_base',
 'action' = 'index',
 ),
 ),
 ),

 I'm wondering if it is acceptable or not.
 What's the best practise ?


 --
  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-key-name-in-the-config-best-practise-tp4659857.html
  To start a new topic under Zend Framework, email
 ml-node+s634137n634138...@n4.nabble.com
 To unsubscribe from Zend Framework Community, click 
 herehttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=634137code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4
 .
 NAMLhttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=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/Re-zend-2-key-name-in-the-config-best-practise-tp4659858.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: How to Validate Backlink

2013-04-28 Thread Marco Pivetta
You can use the URI validator:
https://github.com/zendframework/zf2/blob/master/library/Zend/Validator/Uri.php

It will only validate that the URL that is provided is well-formed. If you
need to check if the page exists, you will need to implement your own
validator that verifies the response headers for an http request against
that URL.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 26 April 2013 13:08, wangjiehui [via Zend Framework Community] 
ml-node+s634137n4659841...@n4.nabble.com wrote:

 Dear All,

 I'm think of design a webpage,which contain form, and there's a form
 element, that I want it to validate a  backlink in another site, (to check
 whether my site url exist or not in other people's website). I see a lot of
 form helpers,but there's no such a helper to validate backlink.

 By the way, I'm learning Zend framework 2.0.

 Thank you in advance.

 Best wishes !
 Jeff



  Lampk


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://zend-framework-community.634137.n4.nabble.com/How-to-Validate-Backlink-tp4659841.html
  To start a new topic under Zend Framework, email
 ml-node+s634137n634138...@n4.nabble.com
 To unsubscribe from Zend Framework Community, click 
 herehttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=634137code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4
 .
 NAMLhttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=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/How-to-Validate-Backlink-tp4659841p4659859.html
Sent from the Zend Framework mailing list archive at Nabble.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: 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] 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
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.

?php
namespace BlogTest\Service;

use Zend\Test\PHPUnit\Controller\AbstractControllerTestCase;

class DateTest extends AbstractControllerTestCase
{
  public function setUp()
  {
$this-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




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

2013-04-28 Thread David Muir
My guess is that it's because your value is outside the min/max range 
you've specified.
'value' would be today, 'min' would be 30 months ago, and 'max' is 18 
months ago.
You're subtracting 30 months from $date, then adding 1 year back to it 
again. You'll want to add 42 months back to it, or clone your date 
object for each date calculation.


Cheers,
David


On 17/10/12 22:56, miszyman wrote:

Hi,

I'm currently migrating from ZF1 to ZF2, and I have some trouble in creating
forms, one of them is I cannot properly set the date format for the DateTime
element I am trying to do sth like this (i've changed it a few times but its
just to get the idea)

$date = new \DateTime();
$date_formated = $date-format('d/m/Y H:i');


$this-add ( array (
'name' = 'registration_starts',
'type' = 'Zend\Form\Element\DateTime',
'options' = array (
'format'='d/m/Y H:i',
'label' = 'Registration start 
Date/Time',

),
'attributes' = array (
'value'= $date_formated,
'class'='datetime picker',
'min' = $date-sub(new 
\DateInterval('PT30M'))-format('d/m/Y H:i'),
'max' = $date-add(new 
\DateInterval('P1Y'))-format('d/m/Y H:i'),
'step' = '1',
)
)
);
$this-get('trn_registration_starts')-setFormat('d/m/Y H:i');

and with such element I get error Invalid date param given from the
Zend/Validator/DateStep.php:234, how should it be done?

In future I'd also like to set the date format from the users locale;




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