-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE-5] Create configs and integrate with datepicker()
- Loading branch information
Pedro Teixeira
committed
Mar 13, 2013
1 parent
a87a789
commit 885371f
Showing
19 changed files
with
312 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace PedroTeixeira\Bundle\GridBundle\Grid\Filter\Operator; | ||
|
||
use Symfony\Component\Locale\Stub\DateFormat\FullTransformer; | ||
|
||
/** | ||
* Date | ||
*/ | ||
class Date extends OperatorAbstract | ||
{ | ||
/** | ||
* @param string|array $value | ||
*/ | ||
public function execute($value) | ||
{ | ||
$transformer = new FullTransformer( | ||
$this->container->getParameter('pedro_teixeira_grid.date.date_format'), | ||
$this->container->getParameter('locale') | ||
); | ||
$date = new \DateTime(); | ||
$transformer->parse($date, $value); | ||
|
||
$queryBuilder = $this->getQueryBuilder(); | ||
|
||
$where = $this->getQueryBuilder()->expr()->like($this->getIndex(), ":{$this->getIndexClean()}"); | ||
|
||
if ($this->getWhere() == 'OR') { | ||
$queryBuilder->orWhere($where); | ||
} else { | ||
$queryBuilder->andWhere($where); | ||
} | ||
|
||
$queryBuilder->setParameter($this->getIndexClean(), $date->format('Y-m-d') . '%'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.