Skip to content

Commit adbfa4c

Browse files
committed
docs unified snake_case and camelCase
1 parent 8ca7813 commit adbfa4c

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

docs/database/migrations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Within both of these methods, you may use the TinyORM schema builder to expressi
256256

257257
} // namespace Migrations
258258

259-
Migration classes can be named in two formats, StudlyCase without the datetime prefix and snake_case with the datetime prefix. If the StudlyCase name is used then the `T_MIGRATION` macro must also be used in the migration class.
259+
Migration classes can be named in two formats, StudlyCase without the datetime prefix and "snake_case" with the datetime prefix. If the StudlyCase name is used then the `T_MIGRATION` macro must also be used in the migration class.
260260

261261
Naming with the datetime prefix should look like this.
262262

docs/tinyorm/casts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Accessors are currently only used during the serialization by the [Appending Val
2626

2727
### Defining An Accessor
2828

29-
An accessor transforms a TinyORM attribute value when it is accessed (currently during serialization only by the [Appending Values](tinyorm/serialization.mdx#appending-values-to-json) feature). To define an accessor, create a protected method on your model to represent the accessible attribute. This method name should correspond to the "camel case" representation of the true underlying model attribute / database column when applicable.
29+
An accessor transforms a TinyORM attribute value when it is accessed (currently during serialization only by the [Appending Values](tinyorm/serialization.mdx#appending-values-to-json) feature). To define an accessor, create a protected method on your model to represent the accessible attribute. This method name should correspond to the "camelCase" representation of the true underlying model attribute / database column when applicable.
3030

3131
In this example, we'll define an accessor for the `first_name` attribute. The accessor will automatically be called by TinyORM during serialization if the `first_name` attribute is defined in the `u_appends` data member set. All attribute accessor methods must return the `Orm::Tiny::Casts::Attribute`:
3232

docs/tinyorm/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Let's examine a basic model class and discuss some of TinyORM's key conventions:
129129

130130
### Table Names
131131

132-
After glancing at the example above, you may have noticed that we did not tell TinyORM which database table corresponds to our `Flight` model. By convention, the "snake case", plural name of the class will be used as the table name unless another name is explicitly specified. So, in this case, TinyORM will assume the `Flight` model stores records in the `flights` table, while an `AirTrafficController` model would store records in an `air_traffic_controllers` table.
132+
After glancing at the example above, you may have noticed that we did not tell TinyORM which database table corresponds to our `Flight` model. By convention, the "snake_case", plural name of the class will be used as the table name unless another name is explicitly specified. So, in this case, TinyORM will assume the `Flight` model stores records in the `flights` table, while an `AirTrafficController` model would store records in an `air_traffic_controllers` table.
133133

134134
If your model's corresponding database table does not fit this convention, you may manually specify the model's table name by defining the private `u_table` data member on the model:
135135

docs/tinyorm/relationships.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ If the parent model does not use `id` as its primary key, or you wish to find th
203203
return belongsTo<User>("foreign_key", "owner_key");
204204
}
205205

206-
The third `belongsTo` parameter is the relation name, if you pass it, the foreign key name will be determined from it. By convention, TinyORM will "snake case" this relation name and suffix it with a `_` followed by the name of the parent model's primary key column to generate foreign key, the `__func__` predefined identifier is ideal for this. The relation name is also used in BelongsTo's `associate` and `disassociate` methods:
206+
The third `belongsTo` parameter is the relation name, if you pass it, the foreign key name will be determined from it. By convention, TinyORM will "snake_case" this relation name and suffix it with a `_` followed by the name of the parent model's primary key column to generate foreign key, the `__func__` predefined identifier is ideal for this. The relation name is also used in BelongsTo's `associate` and `disassociate` methods:
207207

208208
/*! Get the user that owns the phone. */
209209
std::unique_ptr<BelongsTo<Phone, User>>
@@ -251,7 +251,7 @@ A one-to-many relationship is used to define relationships where a single model
251251

252252
#endif // POST_HPP
253253

254-
Remember, TinyORM will automatically determine the proper foreign key column for the `Comment` model. By convention, TinyORM will take the "snake case" name of the parent model and suffix it with `_id`. So, in this example, TinyORM will assume the foreign key column on the `Comment` model is `post_id`.
254+
Remember, TinyORM will automatically determine the proper foreign key column for the `Comment` model. By convention, TinyORM will take the "snake_case" name of the parent model and suffix it with `_id`. So, in this example, TinyORM will assume the foreign key column on the `Comment` model is `post_id`.
255255

256256
Once the relationship method has been defined, we can access the `QVector<Related *>` of related comments by Model's `getRelationValue<Related, Container = QVector>` method:
257257

@@ -346,7 +346,7 @@ If your parent model does not use `id` as its primary key, or you wish to find t
346346
return belongsTo<Post>("foreign_key", "owner_key");
347347
}
348348

349-
The third `belongsTo` parameter is the relation name, if you pass it, the foreign key name will be determined from it. By convention, TinyORM will "snake case" this relation name and suffix it with a `_` followed by the name of the parent model's primary key column to generate foreign key, the `__func__` predefined identifier is ideal for this. The relation name is also used in BelongsTo's `associate` and `disassociate` methods:
349+
The third `belongsTo` parameter is the relation name, if you pass it, the foreign key name will be determined from it. By convention, TinyORM will "snake_case" this relation name and suffix it with a `_` followed by the name of the parent model's primary key column to generate foreign key, the `__func__` predefined identifier is ideal for this. The relation name is also used in BelongsTo's `associate` and `disassociate` methods:
350350

351351
/*! Get the post that owns the comment. */
352352
std::unique_ptr<BelongsTo<Comment, Post>>

docs/tinyorm/serialization.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Occasionally, when converting models to vector, map, or JSON, you may wish to ad
182182
}
183183
};
184184

185-
If you would like the accessor to always be appended to your model's vector, map, and JSON representations, you may add the attribute name to the `u_appends` data member set of your model. Note that attribute names are typically referenced using their "snake case" serialized representation, even though the accessor's method name is defined using "camel case":
185+
If you would like the accessor to always be appended to your model's vector, map, and JSON representations, you may add the attribute name to the `u_appends` data member set of your model. Note that attribute names are typically referenced using their "snake_case" serialized representation, even though the accessor's method name is defined using "camelCase":
186186

187187
#include <orm/tiny/model.hpp>
188188

0 commit comments

Comments
 (0)