Propel query builder


not spryker specific, but would help much -

does propel have some kind of working query builder?

$user = DB::table('users')->where('name', 'John')->first();

So how could one do this above, in propel ?




You are actually pretty close. :slight_smile:
Propel has a plethora of magic convenience methods.

So you could do the above as


So, you basically access the query builder through <Entity>Query.
You could also use it like ...->filterBy('name', 'John')->... or even ...->findOneByName('John'), but we advise to use the above and keep you queries in the QueryContainer when you work in Spryker context.



Thank for the reply, I saw this in your documentation.
The usecase I have is following:

I created a new table in my zed DB without defining a model for this.
my table is such a small one, so I do not see a reason to have model here this time.
But what I want is, using this syntax above to query my tables.

Hope I could make this clear


You will always have to generate the models. the Propel commands provide you with the necessary tooling for it.


okay thank you for helping me on this. This helped me I did not see the command for this. now it’s clear