Skip to content

Commit

Permalink
Merge pull request #1 from winkbrace/fix-typos
Browse files Browse the repository at this point in the history
Fix a few typos and expand the documentation a bit
  • Loading branch information
Yoan-Alexander Grigorov committed May 22, 2018
2 parents 2304e88 + c652906 commit e880d62
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 5 deletions.
8 changes: 6 additions & 2 deletions installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Download the :code:`glagol-dsl-server-0.6.3.jar` from the `latest release <https

Then you can alias the :code:`glagol-server` as a command so that it can be used easily. To do that you simply add to the end of :code:`~/.bashrc` (or :code:`~/.zshrc`) the following command::

alias glagol-server='java -Xmx400m -jar /full/path/tp/glagol-dsl-server.jar'
alias glagol-server='java -Xmx400m -jar /full/path/to/glagol-dsl-server.jar'

And then reload your rc::

Expand All @@ -42,7 +42,11 @@ Similarly to the server app the client app jars are available on `Github release

Then you can alias the :code:`glagol` as a command so that it can be used easily. To do that you simply add to the end of :code:`~/.bashrc` (or :code:`~/.zshrc`) the following command::

alias glagol='java -jar /full/path/tp/glagol-dsl-client.jar'
alias glagol='java -jar /full/path/to/glagol-dsl-client.jar'

.. attention::

When using the client as of version >= 0.4, for now you have to run compile with the `-l` (--no-ssh-auth) flag until the ssh feature is completed.

And then reload your rc::

Expand Down
8 changes: 8 additions & 0 deletions setup_with_docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,13 @@ And then you are ready to spin-up the Docker Compose environment::

The Docker Compose configuration will automatically install all PHP Composer dependencies upon containers startup. In fact, it will do so every time you spin-up the containers. See :code:`./scripts/composer.sh` for how it works under the hood.

The credentials for connecting to the mysql database can be found in :code:`docker-compose.yml`.
By default they are:

:Host: localhost
:port: 3307
:database: glagol
:user: root
:password: 123

Next you can proceed directly to :ref:`hello_world_controller`.
64 changes: 63 additions & 1 deletion tutorial_entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ This is because you do not have a constructor that accepts no argument as used i
}
}
This instantiation will use the second constructor because of the mathcing signature (:code:`string, string`).
This instantiation will use the second constructor because of the matching signature (:code:`string, string`).
Note that glagol only accepts double quotes :code:`"` for strings and not single quotes.

Next, compile the app and after you :code:`$ curl localhost:8081/song` the output will be:

.. code-block:: json
Expand Down Expand Up @@ -217,3 +219,63 @@ Lets default the song genre by adding a constructor without a guard:
}
The next chapter explains how to read, persist and delete entities from the database.

Relationships
------
Glagol DSL also supports database relationships. Say we have a :code:`genres` table that the :code:`songs` table has a foreign key relation to from a field :code:`genre_id`.

.. code-block:: console
mysql> SELECT * FROM glagol.songs;
+----+-------+----------+---------------------------+
| id | title | genre_id | author |
+----+-------+----------+---------------------------+
| 1 | Virus | 1 | Marko Markovic Brass Band |
+----+-------+----------+---------------------------+
mysql> SELECT * FROM glagol.genres;
+----+--------+
| id | name |
+----+--------+
| 1 | Balkan |
+----+--------+
If you create a Genre entity, you can type hint it in the Song entity and Glagol DSL will automatically lazy load it.

.. code-block:: none
namespace MusicLib
@table="genres"
entity Genre {
@id
@sequence
int id;
string name;
}
.. code-block:: none
namespace MusicLib
entity Song {
int id;
string title;
Genre genre;
string author;
}
Querying songs will now result in

.. code-block:: json
{
"id": null,
"title": "Virus",
"genre": {
"id": 1,
"name": "Balkan"
},
"author": "Marko Markovic Brass Band"
}
2 changes: 1 addition & 1 deletion tutorial_hello_world_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The output should be something like::

Testing the index
-----------------
The Docker Compose default project skeleton will run nginx on port :code:`8081` (if you installed a fresh nginx manually the port is porbably :code:`80`)::
The Docker Compose default project skeleton will run nginx on port :code:`8081` (if you installed a fresh nginx manually the port is probably :code:`80`)::

$ curl localhost:8081/hello-world

Expand Down
3 changes: 2 additions & 1 deletion tutorial_persisting_entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Yep - it is *that* simple. Repositories expose the :code:`persist` and :code:`fl

.. note::

Entity persisting and flushing is inspired and based on Doctrine 2 ORM's way of operating with entities.
Entity persisting and flushing is inspired and based on `Doctrine 2 ORM
<https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html>`_'s way of operating with entities.

Finally, lets save our Song entity into the database! Modify the :code:`SongController.g` to use the repository:

Expand Down

0 comments on commit e880d62

Please sign in to comment.