Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible usage of Linq queries in text format #4

Open
morgen2009 opened this issue Jan 23, 2014 · 0 comments
Open

Possible usage of Linq queries in text format #4

morgen2009 opened this issue Jan 23, 2014 · 0 comments
Labels
Milestone

Comments

@morgen2009
Copy link
Owner

Example 1.

/** @var IEnumerable $q */
$q = new Linq\Query(<<<LINQ
     from source in q
     where q => 2 and q < 8
LINQ);
$q->addTerm('source', [ 1, 2, 3, 4, 5, 6, 7, 8 ]);

Example 2. Partially executed as SQL command

/** @var IEnumerable $q */
$q = new Linq\Query(<<<LINQ
     from db.Product in p
     join db.Category in c on c.id = p.category_id
     where p.title like "%blue%" and myfunc(c.title)
LINQ);
$q->addTerm("db", $doctrine->getEntityManager());
$q->addTerm("myfunc", function($item) {
    return strpos("closed", $item) === false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant