Skip to content

Instantly share code, notes, and snippets.

@Doopin
Doopin / module.config.sample.php
Last active December 28, 2017 18:29
Module Config
<?php
[
'router' => [
'routes' => [
'api.rest' => [
'type' => 'Hostname',
'options' => [
'route' => 'api.site.dev'
],
@Doopin
Doopin / EmailService.php
Created September 16, 2016 10:00
Zend raises an exception if my email subject contains non-ASCII charcters. How to solve it please?
/*
* Here is one method of my email service.
* When the email subject contains non ASCII characters, its raised and exeption "invalid subject detected"
* It works like a charm if subject only contains ASCII characters
*/
/**
* Send an email
* @param \xxxxx\Model\Interfaces\Messages\EmailInterface $emailObject
* @return boolean
@Doopin
Doopin / settings.php
Last active June 23, 2016 12:24
ZF2 CSRF Field not working as expected
/*
* Hello Guys, going through something weird with ZF2 CSRF Field
* Please check this gist for my non-working settings
*/
// LoginForm.php
class LoginForm extends MainForm {
public function __construct($name = 'loginForm', $options = []) {
@Doopin
Doopin / zf2.php
Created June 17, 2016 02:51
Configuration Issue ZF2
/*
* I have 4 modules which are well loaded
*/
// Action called
public function indexAction() {
$this->layout('layout/default');
return [
@Doopin
Doopin / add.php
Last active October 11, 2015 13:52
Csrf field validation always fails
<?php
//The form declaration Class
$this->add(array(
'type' => 'Csrf',
'name' => 'sec',
'options' => array(
'csrf_options' => array(
'timeout' => 600
)
)
@Doopin
Doopin / HydratingResultSet ZF2
Created May 13, 2015 14:57
How to reset HydratingResultSet for many iterations?
//In myMapper class, I have this method
public function loadAllPosts() {
$postObject = new Post();
$userObject = new User();
$select = new Select();
$select->from(['post' => $postObject->tableName()])
->join(['user' => $userObject->tableName()], 'post.user= user.id');
@Doopin
Doopin / gist:215cd04df2d48a425079
Created April 27, 2015 14:11
Validation not working for date format YYYY-MM
<div class="form-group">
<label for="startDate" class="col-xs-12 control-label">Start date</label>
<div class="col-xs-12">
<input id="startDate" required name="experience[startDate]" data-fv-notempty-message="date is required"
type="date" placeholder="YYYY-MM" class="form-control revalidate start-date input-sm single-date-picker-month"
data-fv-date="true" data-fv-date-separator="-" data-fv-date-format="YYYY-MM" data-fv-date-message="Invalid date"/>
</div>
</div>
@Doopin
Doopin / gist:74817920a3847c198332
Created April 8, 2015 16:02
Modify Select2 CSS
/*Put this CSS declaration in another file which will be loadeed after Select2 Css file*/
/* He we reset the border-radius only for a particular bloc */
#sign-up-form .select2-container .select2-selection--single {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
/* This css will force select2 box heigth to match with standard Bootstrap input element height*/
@Doopin
Doopin / gist:d639d045f6985b671f05
Created April 4, 2015 13:49
How to fix this On Select2 4 with Bootstrap 3.3.4
<div>
<div class="form-group">
<div class="col-sm-6">
<label class="control-label" for="gender"><?php echo ucfirst($this->translate('sexe')); ?></label>
<div class="input-group">
<span class="input-group-addon">
<span class="icomoon-mars"></span>
</span>
<select required class="select-without-search form-control" name="gender" data-fv-notempty
data-placeholder="Select gender"
$inputFilter->add($factory->createInput(array(
array(
'name' => 'birthday',
'validators' => array(
array(
'name' => 'Zend\Validator\Date',
'break_chain_on_failure' => true,
)
),
'filters' => array(