Closed websemantics closed 9 years ago
Assignments is a relationship. The difference between what I'm doing and what you're doing it you are forcing it to fetch results. Sounds like the model hydration isn't working properly in this case.
If you look in your compiled model for that stream do you see the assignments that are not working properly?
Try running php artisan streams:recompile
I think that's the right command. See if that fixes it.
When the model loads its compiled data to actual model relations it's not getting picked up.
StreamModel->make() is the function in which that happens.
Excellent diagnosis Ryan, ..
I did,
artisan streams:compile
artisan cache:clear
That fixed the problem,
It's probably my fault regarding the model hydration not working properly, (I've overridden the entire process with custom classes) .. I'll look into the code and see why it fails to re-compile after adding the first assignment,
Many thanks for that,
Lol care to share your additions? You're binding extending classes or replacing all together? Might make sense to merge in some of your changes ^_^
I'm binding classes,
protected $bindings = [
/* Override PyroCMS Classes */
'Anomaly\Streams\Platform\Stream\Contract\StreamInterface' => 'Websemantics\StreamsPlatformExtension\Stream\StreamModel',
'Anomaly\Streams\Platform\Stream\StreamModel' => 'Websemantics\StreamsPlatformExtension\Stream\StreamModel',
'Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface' => 'Websemantics\StreamsPlatformExtension\Stream\StreamRepository',
'Anomaly\Streams\Platform\Stream\StreamRepository' => 'Websemantics\StreamsPlatformExtension\Stream\StreamRepository',
'Anomaly\Streams\Platform\Entry\EntryModel' => 'Websemantics\StreamsPlatformExtension\Entry\EntryModel',
'Anomaly\Streams\Platform\Assignment\AssignmentModel' => 'Websemantics\StreamsPlatformExtension\Assignment\AssignmentModel'
];
I've created an extension for this called, StreamsPlatformExtension
This extension is useful for someone who wants to gain full control over core streams/fields/assignments functionality including the creation of models / translation etc, .. I can share if that sounds useful to anybody :)
Cool! I think it might be something to put up on the market or something ya. If anything to learn from.
Just uploaded the code, .. check it here, https://github.com/websemantics/streams_platform-extension
I'm getting an unexpected behaviour from the TableBuilder/TableColumn etc and Stream Model, ..
After fresh install, this is what I get from a TableBuilder, for a custom Module,
This happens - I figured - because the StreamModel will only return 1 assignment, hence, 'Name' is the only one recognized,
If I change line 310 in the https://github.com/anomalylabs/streams-platform/blob/1.0/develop/src/Stream/StreamModel.php#L310 to
public function getAssignments() { return $this->assignments()->get(); }
That would get it to work,
Any thought of why this is?!
Many thanks