This project is just example code. Not really usable for anything else.

Verifying requirements

  1. Create a local SQLite database, and populate database using dummy data (dataset has been reduced substantially to run with ORM on SQLite. Every proper RDBMS has its own, most effective way of bulk inserts)

    ./bin/doctrine orm:schema-tool:create php ./bin/populatedb.php

  2. Verified using PHPUnit. See Crud.php ("Application" vague enough to fit ^^)

  3. Confusing task description? As it's listed under "Server Side", but looks like frontend task?

  4. Email every project member of expired projects

    php ./bin/emailpeople.php

  5. Get contact details as JSON for id 1

    php-cgi -f public/service.php id=1

Running tests

Install dependencies using composer, and run phpunit

composer install
phpunit

Model approach

I have chosen to use an ORM (Doctrine) both for flexibility and (development) speed. It might be cheating slightly, as the database schemas will get generated by the ORM. However, the pattern I would have chosen for the mappings would be joining tables like;

City (fields + primary key) Citizen (fields + primary key + city_id) -- Assuming a citizen only lives in one city Citizen_Project (citizen_id, project_id) -- Adding a contraint for all id pairs to be unique Project (fields + primary key)

UTF-8 for any char/varchar/text field Adding indexes to all primary key fields (including on joining tables) Adding NOT NULL for mandatory fields Use inner joins when appropriate

Models are implemented using a fluent interface by design