T
T
templton19822016-08-31 22:46:19
symfony
templton1982, 2016-08-31 22:46:19

How to get repository data in controller?

I get the entity data in the controller:

$user_avalable_stocks=$em->getRepository('StockerStockBundle:Userstock')->getUserAvailableStocks($request->get('userid'));

In twig, I access the required fields like this:
{% for stock in user_avalable_stocks %}
                <option val="{{stock.id}}">{{stock.stockname}}</option>
{% endfor %}

And how to make such search in the controller?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2016-08-31
@templton1982

foreach ($user_avalable_stocks as $stock) {
   // ???
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question