Closed gvanto closed 5 months ago
Maybe I am not "finding" the record correctly? How are attributes accessed on a given record/object?
Why does it use $model->find() rather than MyModel::find() ?
I can't see a find() method anywhere in DynamoDbModel? So if my class extends that class, how does $model->find() work?
Assuming that MyModel extends DynamoDbModel.
Finding the docs quite unclear on this ... (sample of good docs).
Yes, you can use the static find()
normally in your model. DynamoDbModel
inherits all methods from Model
, just adjusting the required ones to work with Dynamo DB.
@gvanto You have some problems in your model definition:
$fillable
and $guarded
together. It is not recommended to use $fillable
and $guarded
together because they have opposite effects; $fillable
allows only the specified attributes to be mass assigned, while $guarded
blocks only the specified attributes from being mass assigned. As recommendation, you can use a sub-namespace for DynamoDb models (
App\Models\Dynamo\...
) instead of using a prefix in the model name. With this, you can take advantage of the automagic benefits of Laravel's models for table names and else.And, sorry for the lack in the documentation. I had not have much time to make some improvements I planned to. That's in the roadmap tho.
Describe the bug
Cannot access property 'target' of returned record.
TestController:
DynamoDBRedirect.php:
Result on test controller output:
Result with dd($redir): ('target' is in 'attributes' array - but can't be accessed with $redir->target ?):
Schema table=redirects
Item exists in DDB, call from CLI:
Response:
Describe your table schema:
Primary key / composite key PK=source
Any index? None
Debug info
Version info