I
I
ImPuuLsE2015-10-24 16:19:11
Yii
ImPuuLsE, 2015-10-24 16:19:11

How to add a new property to a selection from a database in Yii2?

Hello, I added a new property to the model:

class Product extends \yii\db\ActiveRecord
{
    public $searchingBy;

I am now looking for a product:
$product = Product::findOne(1);
How to set the value of this property correctly, and push it into the object with the product?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pantsarny, 2015-10-24
@ImPuuLsE

$product->searchingBy = 'some value';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question