This project is no longer maintained. We will not be accepting pull requests, addressing issues, nor making future releases.
Employee Directory is a sample application for demonstrating the usage of Breeze JS library. This sample tries to show the features of breezejs as many as possible while keeping the data model as simple as possible.
Inspired by the sample applications of Christophe Coenraets.
The application is an Employee Directory that allows you to look for employees by name, view the details of an employee, and navigate up and down the Organization Chart by clicking the employee’s manager or any of his/her direct reports.
Additionally, the application also features a CRUD implementation to add,edit and delete employees, departments or job titles.
- Handling navigation properties (associations) automagically
- (Lookups) Employee's job and department are not fetched along with the employees, but queried separately when application loads and breeze take the responsibility to assign their department and job.
- If an employee's manager is already available in the cache, we don't have to query the server again to get him/her.
- (Lazy loading) When there are any direct reports of employees available in the cache, list them, and fetch all the direct reports from server, since we don't know if all the direct reports of that employee are available in the cache
- (Unit of Work) Saving all the changes in a single transaction
- (Extending Entities)
fullNameis a computed property offirstName + ' ' + lastNamewhich is made possible by MetadataStore'sregisterEntityTypeCtormethod - Client side and server side validations. Enter "lorem" as firstName and try to save, to see an example of server side error.
- Showing the usage of date handling with momentjs with knockout date bindings
- Demonstrating HTML5 image upload with breeze and knockout file bindings
- Demonstrates how a breeze CRUD implementation can be done with a Durandal widget
getXXXmethods of dataservice are synchronous and return the result(s) whilefindXXXmethods are asynchronous and return a promise of result(s)- view and viewmodel (of a durandal module) are grouped by the name of the module and named as the names of the module itself
The server implementation uses breeze.server.php, a library to create breeze compatible servers in PHP with Doctrine 2 ORM.
- Mappings in Annotations, YAML or XML
- Demonstrating Doctrine life cycle callbacks:
Employee::saveProfilePic()method is called before an entity is inserted or updated in the database. - Demonstrating the use of custom properties that are not persisted in the database:
Employee::$profilePicContentis a write-only property that stores the base64-encoded profile pic image string and is not a doctrine-mapped property. - Demonstrating how you can handle file uploads in modern applications with just Doctrine itself, without using http file uploading technology: when
Employee::saveProfilePic()method is called, it readsEmployee::$profilePicContent, decodes the base64 string, saves it in a file and sets theEmployee::$profilePicto the newly created file path. - Demonstrating how you can control the JSON API with JMS Serializer: Since
Employee::$oldProfilePicis an internal property, it is excluded from the serialized results. - Demonstrating validations with Symfony validation constraints::
Employee::$firstNameis required,Employee::$websiteshould be a url. - Demonstrating server side custom validation errors:
Employee::$firstNamecannot be equal to "lorem" or "ipsum"
There are three varieties of the same application to prove the fact that breeze.server.php is a framework agnostic library.
- Doctrine with XML mappings, Serializer with XML mappings and Validator with XML Mappings
- Demonstrating the usage of
StandaloneApplicationclass from the framework - No other dependencies!
- You can run doctrine commands by typing
$ php vendor/bin/doctrinein a terminal from the path whereindex.phplives.
- All mappings in YAML format.
- Demonstrating the usage of
Applicationclass from the framework - Demonstrating how to make the
Applicationclass as a service, leveraging the existingdoctrine.orm.entity_manager,jms_serializerandvalidatorservices. - Demonstrating how you can use routing and the current request object without creating a new one
- You can list doctrine commands by typing
$ php app/console list doctrine - Learn more about symfony specific doctrine stuff.
- All mappings in Annotations format.
- Demonstrating how you can use database configuration from
config/database.phpfile. - Demonstrating how you can use routing and the current request object without creating a new one
- You can run doctrine commands by typing
$ php vendor/bin/doctrinefrom the same path where you runartisancommands.
- Place this folder (
Employee Directory) into a web accessible folder. If you are using XAMPP,htdocsshould be the web root. - run
composer updatefromserver/standalonedirectory. If you are interested in theserver/symfonyorserver/laravelimplementations, do accordingly.
- A MySql dump is available in
server/mysql-dump.sqlfile. - Create a database, import the dump file and, change the database configuration in:
- standalone -
bootstrap.php - symfony -
app/config/parameters.yml - laravel -
app/config/database.php
- standalone -
- the client application uses bower to manage client side dependencies. run
bower installfromclientdirectory to install the dependencies. - if you want the client to work with
server/symfonyorserver/laravelchange the serviceName inclient/dataservice.jsto the corresponding server location.
- Open
http://localhost/Employee Directory/clientto view the application

