<commit_before><?php

/*
 * This file is part of the HomeFinanceV2 project.
 *
 * (c) Rafalsky.com <http://github.com/Rafalsky/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\models\base;

use app\models\Product;
use app\models\Receipt;
use yii\db\ActiveRecord;

/**
 * This is the base-model class for table "receipt_product".
 *
 * @property integer $id
 * @property integer $receipt_id
 * @property integer $product_id
 * @property double $count
 * @property string $total_price
 * @property string $created_at
 * @property string $updated_at
 *
 * @property \app\models\Product $product
 * @property \app\models\Receipt $receipt
 * @property string $aliasModel
 */
abstract class ReceiptProduct extends ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%receipt_product}}';
    }

    /**
     * Alias name of table for crud viewsLists all Area models.
     * Change the alias name manual if needed later
     * @param bool $plural
     * @return string
     */
    public function getAliasModel($plural = false)
    {
        if ($plural) {
            return \Yii::t('app', 'ReceiptProducts');
        } else {
            return \Yii::t('app', 'ReceiptProduct');
        }
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['receipt_id', 'product_id', 'created_at'], 'required'],
            [['receipt_id', 'product_id'], 'integer'],
            [['count', 'total_price'], 'number'],
            [['created_at', 'updated_at'], 'safe'],
            [
                ['product_id'],
                'exist',
                'skipOnError' => true,
                'targetClass' => Product::className(),
                'targetAttribute' => ['product_id' => 'id']
            ],
            [
                ['receipt_id'],
                'exist',
                'skipOnError' => true,
                'targetClass' => Receipt::className(),
                'targetAttribute' => ['receipt_id' => 'id']
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => \Yii::t('app', 'ID'),
            'receipt_id' => \Yii::t('app', 'Receipt ID'),
            'product_id' => \Yii::t('app', 'Product ID'),
            'count' => \Yii::t('app', 'Count'),
            'total_price' => \Yii::t('app', 'Total Price'),
            'created_at' => \Yii::t('app', 'Created At'),
            'updated_at' => \Yii::t('app', 'Updated At'),
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeHints()
    {
        return array_merge(
            parent::attributeHints(),
            [
                'id' => \Yii::t('app', 'ID'),
                'receipt_id' => \Yii::t('app', 'Receipt Id'),
                'product_id' => \Yii::t('app', 'Product Id'),
                'count' => \Yii::t('app', 'Count'),
                'total_price' => \Yii::t('app', 'Total Price'),
                'created_at' => \Yii::t('app', 'Created At'),
                'updated_at' => \Yii::t('app', 'Updated At'),
            ]
        );
    }

    /**
     * @return \\Yii\db\ActiveQuery
     */
    public function getProduct()
    {
        return $this->hasOne(Product::className(), ['id' => 'product_id']);
    }

    /**
     * @return \\Yii\db\ActiveQuery
     */
    public function getReceipt()
    {
        return $this->hasOne(Receipt::className(), ['id' => 'receipt_id']);
    }
}<commit_msg>Master: Fix ReceiptProduct model class<commit_after><?php

/*
 * This file is part of the HomeFinanceV2 project.
 *
 * (c) Rafalsky.com <http://github.com/Rafalsky/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\models\base;

use yii\db\ActiveRecord;

/**
 * This is the base-model class for table "receipt_product".
 *
 * @property integer $id
 * @property integer $receipt_id
 * @property integer $product_id
 * @property double $count
 * @property string $total_price
 * @property string $created_at
 * @property string $updated_at
 *
 * @property \app\models\Product $product
 * @property \app\models\Receipt $receipt
 * @property string $aliasModel
 */
abstract class ReceiptProduct extends ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%receipt_product}}';
    }

    /**
     * Alias name of table for crud viewsLists all Area models.
     * Change the alias name manual if needed later
     * @param bool $plural
     * @return string
     */
    public function getAliasModel($plural = false)
    {
        if ($plural) {
            return \Yii::t('app', 'ReceiptProducts');
        } else {
            return \Yii::t('app', 'ReceiptProduct');
        }
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['receipt_id', 'product_id', 'created_at'], 'required'],
            [['receipt_id', 'product_id'], 'integer'],
            [['count', 'total_price'], 'number'],
            [['created_at', 'updated_at'], 'safe'],
            [
                ['product_id'],
                'exist',
                'skipOnError' => true,
                'targetClass' => Product::className(),
                'targetAttribute' => ['product_id' => 'id']
            ],
            [
                ['receipt_id'],
                'exist',
                'skipOnError' => true,
                'targetClass' => Receipt::className(),
                'targetAttribute' => ['receipt_id' => 'id']
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => \Yii::t('app', 'ID'),
            'receipt_id' => \Yii::t('app', 'Receipt ID'),
            'product_id' => \Yii::t('app', 'Product ID'),
            'count' => \Yii::t('app', 'Count'),
            'total_price' => \Yii::t('app', 'Total Price'),
            'created_at' => \Yii::t('app', 'Created At'),
            'updated_at' => \Yii::t('app', 'Updated At'),
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeHints()
    {
        return array_merge(
            parent::attributeHints(),
            [
                'id' => \Yii::t('app', 'ID'),
                'receipt_id' => \Yii::t('app', 'Receipt Id'),
                'product_id' => \Yii::t('app', 'Product Id'),
                'count' => \Yii::t('app', 'Count'),
                'total_price' => \Yii::t('app', 'Total Price'),
                'created_at' => \Yii::t('app', 'Created At'),
                'updated_at' => \Yii::t('app', 'Updated At'),
            ]
        );
    }

    /**
     * @return \\Yii\db\ActiveQuery
     */
    public function getProduct()
    {
        return $this->hasOne(\app\models\Product::className(), ['id' => 'product_id']);
    }

    /**
     * @return \\Yii\db\ActiveQuery
     */
    public function getReceipt()
    {
        return $this->hasOne(\app\models\Receipt::className(), ['id' => 'receipt_id']);
    }
}
{'fraction_non_alphanumeric': 0.16949854952341484, 'fraction_numerical': 0.0002762812543168946, 'mean_word_length': 1.8925289652417099, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6176606', 'n_tokens_mistral': 2255, 'n_tokens_neox': 2159, 'n_words': 486}