Score:1

Twig: how to get values from [someName:protected]?

id flag

When I kint:

{{ kint(elements.steps[0].step.description['#object']) }}

I get:

...
[activities:protected] => Array
    (
       (
        [17] => stdClass Object
            (
                [__CLASS__] => stdClass
                [id] => 17
                [vid] => 17
                [type] => opigno_video
                [name] => Dzień 1
                [usage_activity] => local
                [skills_list] => 
                [skill_level] => 
                [activity_status] => 1
                [weight] => -1000
                [max_score] => 10
                [auto_update_max_score] => 0
                [omr_id] => 25
                [omr_pid] => 
                [child_id] => 17
                [child_vid] => 17
            )
...

I would like to get all these activities, can I get them inside twig file? I tried:

{{ kint(elements.steps[0].step.description['#object']->get('activities') }}
{{ kint(elements.steps[0].step.description['#object']->activities) }}

And some other options, but no result so far.

leymannx avatar
ne flag
What's this step? What's this template? Sometimes easier to preprocess it into the template.
john Smith avatar
gr flag
it´s a protected property, so you can only access this if there´s a public method in that class that returns the activities, pls find out which typeof #object is and check the source for methods
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.