Skip to content

Instantly share code, notes, and snippets.

View piotrpasich's full-sized avatar

Piotr Pasich piotrpasich

View GitHub Profile
{
ArticleType:
{
name: Article Name
apiMethod: getArticleType
type: HardwareSet
}
ArticleType:
{
name: Article name 2
#app/config/parameters.yml
google_api.client_id: "2988145xxxxxapps.googleusercontent.com"
google_api.client_secret: "xxxxxycQWunSdF5Gcvnr1nn6"
google_api.redirect_uri: "http://test.xsolve.pl/oauth2callback"
google_api.dev_key: xsdevnewtest
#app/config/parameters.yml
google_api:
client_id: "29881450xxxx.apps.googleusercontent.com"
client_secret: "xxxxxycQWunSdF5Gcvnr1nn6"
redirect_uri: "http://test.xsolve.pl/oauth2callback"
dev_key: xsdevnewtest
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="xsolve.test.google.authorization.manager.class">Xsolve\TestBundle\Service\GoogleAuthorizationManager</parameter>
</parameters>
<?php
namespace Xsolve\TestBundle\Service;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Bundle\TwigBundle\TwigEngine as Templating;
use Symfony\Component\DependencyInjection\ContainerInterface;
use GoogleApi\Client;
use GoogleApi\Contrib\apiOauth2Service;
use Symfony\Component\HttpFoundation\Request;
<?php
namespace Xsolve\TestBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
<?php
namespace Xsolve\AcmeBundle\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
/**
* SoundexFunction ::= "SOUNDEX" "(" StringPrimary ")"
*/
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
dql:
string_functions:
soundex: Xsolve\AcmeBundle\DQL\SoundexFunction
<?php
namespace Xsolve\AcmeBundle\Extension\Doctrine;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
/**
* @example by https://gist.github.com/1234419 Jérémy Hubert
* "MATCH_AGAINST" "(" {StateFieldPathExpression ","}* InParameter {Literal}? ")"
<?php
return $this->createQueryBuilder('p')
->addSelect("MATCH_AGAINST (p.name, p.country, p.street, p.postal, p.city, p.state, :address 'IN NATURAL MODE') as score")
->add('where', 'MATCH_AGAINST(p.name, p.country, p.street, p.postal, p.city, p.state, :address) > 0.8')
->setParameter('address', $address)
->getQuery()
->getResult();