1. Go to this page and download the library: Download quellabs/objectquel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
quellabs / objectquel example snippets
$results = $entityManager->executeQuery("
range of p is App\\Entity\\Product
range of c is App\\Entity\\Category via p.categories
retrieve (p, c.name as categoryName)
where p.price < :maxPrice and c.active = true
sort by p.name asc
", [
'maxPrice' => 50.00
]);
// Wildcard matching — no LIKE syntax needed
retrieve (p) where p.sku = "ABC*XYZ"
// Regex with flags
retrieve (p) where p.name = /^tech/i
retrieve (p) where search(p.description, "banana +pear -apple")
range of order is App\\Entity\\OrderEntity
range of product is json_source('external/product_catalog.json')
retrieve (order, product.name, product.manufacturer)
where order.productSku = product.sku and order.status = :status
sort by order.orderDate desc
// In the retrieve clause
retrieve (p.name, ANY(o.orderId) as hasOrders)
// In the where clause
retrieve (p) where ANY(o.orderId)
$results = $entityManager->executeQuery("
range of o is App\\Entity\\Order
range of c is App\\Entity\\Customer via o.customerId
retrieve (o, c.name) where o.createdAt > :since
sort by o.createdAt desc
window 0 using window_size 20
");
$results = $entityManager->createQuery(
'SELECT o, c.name FROM App\\Entity\\Order o
JOIN o.customer c
WHERE o.createdAt > :since
ORDER BY o.createdAt DESC'
)->setParameter('since', $since)
->setMaxResults(20)
->getResult();
use Quellabs\ObjectQuel\Configuration;
use Quellabs\ObjectQuel\EntityManager;
$config = new Configuration();
$config->setEntityNamespace('App\\Entity');
$config->setEntityPath(__DIR__ . '/src/Entity');
$entityManager = new EntityManager($config, $connection);
// Standard lookups
$product = $entityManager->find(Product::class, 101);
$active = $entityManager->findBy(Product::class, ['active' => true]);
// ObjectQuel for anything more complex
$results = $entityManager->executeQuery("
range of p is App\\Entity\\Product
retrieve (p) where p.name = /^Tech/i
sort by p.createdAt desc
window 0 using window_size 10
");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.