Skip to content

relation behavior #1035

Answered by WebVPF
as7ali asked this question in Q&A
Discussion options

You must be logged in to vote

Syntax error in folder/models/Product.php

public $table = 'as7_relationtest_product'; ';   // table fields : id,name,category_id
public $belongsTo = [   'category' => [Category::class]    ];

Twice '; '; in t_product'; '; // table

Corrected:

public $table = 'as7_relationtest_product'; // table fields : id,name,category_id

public $belongsTo = [
    'category' => [Category::class]
];

In folder/controllers/Category.php values in $implement

use Backend\Classes\Controller;
use BackendMenu;

class Category extends Controller
{
    public $implement = [
        \Backend\Behaviors\FormController::class,
        \Backend\Behaviors\ListController::class,
        \Backend\Behaviors\RelationControlle…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by as7ali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants