mootensai / yii2-relation-trait

Yii 2 Models add functionality for load with relation, & transactional save with relation PLUS soft delete/restore feature
47 stars 45 forks source link

Using Enhanced Yii2 Gii - no relation #19

Closed skoncar closed 8 years ago

skoncar commented 8 years ago

Hi,

I have simple table in database:

CREATE TABLE Document ( DocumentID INTEGER NULL, Title VARCHAR(50), Published DATE );

ALTER TABLE Document ADD PRIMARY KEY (DocumentID);

I created model and CRUD, but when I try to create new Document I'm getting error: Invalid Parameter – yii\base\InvalidParamException app\models\Document has no relation named "published-document-published". Caused by: Unknown Method – yii\base\UnknownMethodException Calling unknown method: app\models\Document::getpublished-document-published()

Please help me, I'm getting this error only when I have Date field in database.

mootensai commented 8 years ago
                                                                                  Add your attribute to skipped relation when save/load.                                                                                          
skoncar commented 8 years ago

I tried to add Published in skipped relations in CRUD generator but it's still same. Do I have to make some changes directly in code?

mootensai commented 8 years ago
                                                                                  Please send me your schema.. I'll try it later
skoncar commented 8 years ago

I have only one table in my database.

CREATE TABLE Document
(
DocumentID INTEGER NULL,
Title VARCHAR(50),
Published DATE
);
ALTER TABLE Document ADD PRIMARY KEY (DocumentID)
mootensai commented 8 years ago
                                                                                  I'll test tommorrow..
ruffiction commented 8 years ago

Got same problem. Only on fields using Kartiks DateControl. datecreate

mootensai commented 8 years ago
                                                                                  Whoops, suddenly I got something to do, and not bring my laptop with me. I will fix it on Wednesday.
mootensai commented 8 years ago

Thanks! Please try again by updating this package! :grin:

ruffiction commented 8 years ago

Still doesnt work for me. Same error. But already thanks for trying fix it.

mootensai commented 8 years ago

Wait, I'll re-check..

skoncar commented 8 years ago

Still same error...

altairdeark commented 8 years ago

@mootensai Last update is not workable: PHP Fatal Error – yii\base\ErrorException Call to a member function load() on null

$relObj = (empty($value[$relPKAttr[0]])) ? new $relModelClass : $relModelClass::findOne($value[$relPKAttr[0]]); $relObj->load($value, ''); $this->populateRelation($relName, $relObj);

Waiting new updates

mootensai commented 8 years ago
                                                                                  Ok, I'll fix this issue by this week..                                                                                                                                                                                  ‎
ruffiction commented 8 years ago

Next step in our project will be CRUDs. So i hope you'll fix at as soon as possible. Already thanks for this powerful generator.

mootensai commented 8 years ago
                                                                                  I'll fix it as soon as possible. Thank you for using this extension and for reporting this error everyone!
mootensai commented 8 years ago

Please try again.. I've test it, and it works.. Thanks everyone!

@altairdeark : which line is that??

ruffiction commented 8 years ago

Still got same error. Will some infos about Yiiversion or something be helpful for you? enhanced

mootensai commented 8 years ago

Have you run composer update ? From your error it shows RelationTrait line 31, The new code line 31 is no getRelation($relName)‎

ruffiction commented 8 years ago

Yes i did. On no relation tables it works fine now for me but not on tables with relations. Now the relations didnt works fine looks like. Wanna Chat or Email to find a solution? enhanced2

mootensai commented 8 years ago

Can you send your schema?

ruffiction commented 8 years ago

Wrote u in chat.

mootensai commented 8 years ago

ruffiction's problem is not related to this issue..