New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError Cannot assign Cycle\ORM\Reference\Reference to property App\Invoice\Entity\Quote::$client of type ?App\Invoice\Entity\Client #510
Comments
Here is the stack trace. TypeError: Cannot assign Cycle\ORM\Reference\Reference to property App\Invoice\Entity\Quote::$client of type ?App\Invoice\Entity\Client in Project\vendor\cycle\orm\src\Mapper\Proxy\Hydrator\ClosureHydrator.php:35 |
The issue has been resolved by simply changing the nullable: false to true. The Invoice entity, which is very similar to the Quote entity however has its nullable: set to false for the very same foreign keys and is running without this error. So this is confusing. Is it related to the schema perhaps? |
There are no enough code to reproduce or to understand the issue in description. |
Yes I agree there is very little to understand in the description of the error. I am not using any mapper. How would the mapper help me do you think? Basically a quote is created if the client_id is supplied and the quote group rather than the invoice group is chosen. Entity: Quote Sequence of events:
If nullable is set to true in the Entity, the quote can be added through the modal. However when it comes to editing either the client or the group using the quote/_form I get a 1452 integrity constraint violation error. The invoice is working perfectly and you can look at the code in the fork but for some reason the quote is not at this stage. I have uploaded recent changes to the fork. Under the QuoteService/saveQuote I have had to initialize the relation with a eg. setClient(null) command which works in the |
I think the exception has been thrown because an Entity class has been used directly instead of EntityProxy. But why i see ProxyEntityFactory in the stack in this case? |
Here is the config/params:
|
Changes are made directly in the Entities and I keep the : \Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider::class => [ setting enabled in case these changes to the entity ie. Quote, need to be synced to the database. There is currently no schema file that has been generated. I am trying to isolate with as few variables as possible and I have never used a ProxyFactory. |
This issue has been solved. Typo public should be private. public ?Client $client = null; <-------- change public to private. |
What steps will reproduce the problem? In src\Invoice\Entity\Quote.php
What is the expected result? No error.
What do you get instead? The above error.
TypeError
Cannot assign Cycle\ORM\Reference\Reference to property App\Invoice\Entity\Quote::$client of type ?App\Invoice\Entity\Client
Additional info
The text was updated successfully, but these errors were encountered: