function getLang(lang) {
var d = $.Deferred();
$.getJSON(gInit['url'] + '/lang/'+getCookie('lang')+'.json', function(data) {
var items = [];
$.each(data, function(key, val) {
if(key == lang) {
items.push(val);
}
});
d.resolve(items);
});
return d.promise();
}
var test = getLang("users");
test.done(function (data) {
console.log(data);
});
SELECT
messages.*
FROM
messages
WHERE
messages.dialog_id = 3
AND
messages.id NOT IN (
SELECT deletes.message_id FROM deletes WHERE deletes.login = 'vasya'
)
$routeProvider.when('/', {
templateUrl: 'partials/homepage.html',
controller: 'MyController'
});
<div ng-controller="MyController">
// Entity1, она же table1
/**
* @OneToOne(targetEntity="Entity2", mappedBy="parent")
*/
private $child;
// Entity2, она же table2
/**
* @OneToOne(targetEntity="Entity1", inversedBy="child")
* @JoinColumn(name="table1_id", referencedColumnName="id")
*/
private $parent;
$getParams = $this->getRequest()->query->all();
$params = array_filter($getParams, function($el) {
return !empty($el);
});
$queryBuilder = $this->getDoctine()
->getRepository('Entity1')
->createQueryBuilder('t')
->leftJoin('t.child', 'e');
foreach ($params as $key => $val)
{
$where = sprintf('e.%s = :%s', $key, $key);
$queryBuilder
->andWhere($where)
->setParameter($key, $value);
}
$res = $queryBuilder
->getQuery()
->getResult();
<form action="send_path" method="POST">
<input type="text" name="name" value="">
<input type="text" name="phone" value="">
...
<button type="sumbit">Send</button>
</form>
$('form').on('click', 'button[type="submit"]', function (e) {
var form = $(e.currentTarget).closest('form'),
name = form.find('input[name="name"]').val();
...
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
...
});
});
<form method="post">
<textarea id="text" name="text"></textarea>
<button type="submit"></button>
</form>
tinymce.init({
selector: '#text'
});