Skip to content
Romans Malinovskis edited this page Mar 18, 2019 · 21 revisions

Developer Wiki

Welcome and thanks for considering helping out our ATK Data project. The entirety of this project have been contributed under MIT License and is distributed free of charge. Behind the project is a small team who works on various consultancy projects. If you like ATK Data you are welcome to join us.

ATK Data Sponsors

As per MIT License terms, ATK Data comes with no warranty. It's wise if you set aside 10h of your project estimate in case you would run into any complication with the library. Should that be the case - contact support@agiletoolkit.org and to reach out for help from the developer team of ATK Data.

Money received through sponsorship is allocated towards priority bug-fixes and improvement

Joining ATK Data team

Have you got some spare time and energy in the evening? We are a friendly team, who believe in the potential of ATK Data ideology and work to refine developer experience. Join us by contributing your time and help out by solving simple issues. The rest of the team are professionals with 20+ years of web app development experience and if we notice your potential, we will invite you to participate in commercial projects, start-up projects or even pay for some of your work.

Important Topics - RFC

The following topics are currently in focus. We always try to discuss features and produce white-papers before following up with the implementation.

ADP1903-1 Actions

Register Model-specific actions

A model in ATK Data represents one or several real-life objects of same type. The unique quality of ATK is that those fields can be discovered and interpreted by UI, APIs and Add-ons.

Currently ATK Data models are missing implementation of "Action". Unlike a method, action is a high-level operation that could also be interpreted by UI layer and directly presented to the user. This way - instead of making developer implement a custom UI for triggering an obscured method - the action is presented.

Action contains info about arguments, info about return value, action title/icon/presentation options (e.g. danger, confirm), requirements for a model state (specific record, record set, unloaded) and also a method to verify invocation privileges.

Example - Sending a Notification

In our apps we often have model representing a client or a user. We want to make it possible to send a notification to a user.

I'll also assume that a "transport" add-on is available, which can send a message and track it's delivery progress.

Lets start by registering action for the user:

$this->addAction('sendNotification', [
  'args'=>[
    new Action\Argument\Value( function() use($app) { return $app->getTransport(); }  ),
    new Action\
  ]
]);




 - have information about arguments and return value of the action
 - the actual code could be a call-back, dynamic method or residing inside trait.
 - action argument could be a model or a data-set
 - if model is specified may place restrictions on it's persistence

The goals for the action argument description is to:

 - allow UI to intelligently offer user to specify value for each argument
 - allow UI to prepare values or pre-configure arguments
 - remain decoupled and allow for interoperability between add-ons and components from various authors to work together







ATK Data models primary role is to contain meta-information about the model, fields and how it can be persisted. 

Currently we are missing ability to add high-level methods.




Assuming you have the following models:

​``` php
$invoice->hasMany('Lines', new InvoiceLine());
$payment->hasMany('Allocations', new Allocation());

// Allocation hasOne('invoice_id', Invoice());

you may want to copy to copy your structure either into a different data-set (e.g. Archived Invoices) or perhaps into different persistence, there are number of things to consider, like relations, ID mapping, many-to-many relations, field type conversions and more, but ATK Data can take care of that all. As developer you would be able to perform the operation like this:

$associations = $invoices->deepCopy(new Invoice($new_db), ['Lines'], ['id'=>'original_id']);
$payments->deepCopy(new Payment($new_db), ['Allocations'], ['id'=>'original_id'], $associations);

ADP1810-1 Deep Copy (IMPLEMENTED)

Copy model object into different data-set while traversing into relations and mapping links

Assuming you have the following models:

$invoice->hasMany('Lines', new InvoiceLine());
$payment->hasMany('Allocations', new Allocation());

// Allocation hasOne('invoice_id', Invoice());

you may want to copy to copy your structure either into a different data-set (e.g. Archived Invoices) or perhaps into different persistence, there are number of things to consider, like relations, ID mapping, many-to-many relations, field type conversions and more, but ATK Data can take care of that all. As developer you would be able to perform the operation like this:

$associations = $invoices->deepCopy(new Invoice($new_db), ['Lines'], ['id'=>'original_id']);
$payments->deepCopy(new Payment($new_db), ['Allocations'], ['id'=>'original_id'], $associations);

ADP1810-2 Spreadsheet persistence

This is a proposal to implement a configurable read-only spreadsheet persistence. It would allow you to pass an extended configuration but ultimately would offer you the ability to read (and deep copy) data off your spreadsheet.

This persistence will be an add-on relying on PHP Spreadsheet library.

$spreadsheet = new Spreadsheet\Persistence($file, $config);

$model = $spreadsheet->getModel('sheet 2');

// works like a regular model here, so you can pass it into Grid
$app->add('Grid')->setModel($model);

Request for Comments

  • [RFC1 Mutations](RFC1 Mutations)

Development Status

  • Agile Data ^1.0 is safe to use in your project.
  • Progress on ^1.1 is here: https://github.com/atk4/data/milestone/7
    • Refactor $m->join() logic
    • Add support for typecasting (datetime, money, etc)
    • Add support for custom validators (and docs!)
    • Add support for flags (readonly, visible, editable)
    • Start using transactions for CRUD operations
    • Other improvements
  • We brainstorm ideas for ^1.2 in Gitter.im.

Additional resources

  • Put some work in data-primer - a sample app demonstrating features
  • Create some publicity in Google+, Facebook and Twitter
  • Create blog post on features from 1.1
  • Create screencast video update for 1.1

Research

  • Create Full Agile Data feature Matrix
  • Crowdsource feature comparison with generic ORMs (cake, eloquent, fuel, etc)
  • Update migration guides: Yii, Doctrine 2, Eloquent, CakePHP3

Draft Documentation

Here are some documents that we are still changing and at some point they must be moved into General Documentation.

  • [SQL Action Matrix](SQL Action Matrix) - how queries are constructed for different actions()
  • Hooks - which hooks are needed and what are the parameters
  • Use of branches - On release policy, branches and to help you decide which version to use.

Obsolete Info

Needs to make sure it's fully moved into Docs and delete. Those documents may be inaccurate.

  • Business Models - Implement a clean business logic [DM].
  • Active Record - Use this when you need individual record access [DM].
  • Explicit Loading and Saving - Don't rely on framework to do loading magic for you. Load data yourself. [PM]
  • Relation Mapping - Traverse between business data [DM].
  • Persistence - Design and tweak how your Business Models are mapped into tables [DM->PM].
  • Derived Queries - Express your Business Models as SQL queries [PM].
  • Expressions - Use Derived queries to add fields in your Business Models that are calculated in SQL [PM].
  • Query Building - Build an execute complex multi-row queries mapped from your Business Models [PM].
  • Unit-testing - Business Models can be decoupled from persistence layer for efficient Unit Testing [DM].
  • Aggregation and Reports - Support report generation techniques, aggregation and unions for your Business models [DM].

Stray Articles

If you find a page on a Wiki that does not belong to any category, link it below:

  • here..

Posts and Articles

We're looking for more 3rd party blogs, tweets and mentions about Agile Data

Links