By Private Profile fd6a0afe on 2018-06-11 08:24 in GSoC 18 Webservices in Joomla

Date: 2nd June 2018

Time: 16:00 (CEST)

Meeting was attended by:

  • George Wilson

  • Niels Braczek

  • Andrei Isac

Meeting venue: Hangouts

 

Summary

The main topic of discussion was defining the implementation details regarding Joomla ColumnAlias feature that we want to keep in the new Entities project. As a brief introduction, in Joomla, different components have different names to some columns that serve the same purpose, therefore an alias is desired to be made in order to use the same name in the code. The decision was to keep the models attributes always mapped to the columns in the database, enforcing the aliases every time a user interacts with the model instance.

 

Minutes of Meeting

 

  1. Testing Database Schema

Issue: The ddl.sql schema is outdated in the database package. I have taken data from stubs on the CMS staging branch (csv) and I updated the schema just for the users table for testing purposes. How do we proceed?

 

Solution: George: We are only going to need a limited number of testing tables. Remove everything from ddl.sql for now that is not directly related to com_users. In the future we’ll need some more tables for relations. But we don’t need them to be the same as the ones in the CMS.

 

  1. Making the Model aware of the DatabaseDriver

Issue: How to we pass the DatabaseDriver in the model? The way I did it now, removes the nice static method calls without instantiating the object.

 

Solution: George: What you have there looks fine to me. In real production code you’re going to have your database driver instance sitting in a DI Container (e.g. Joomla’s one https://github.com/joomla-framework/di). Specifically you would call the buildObject method. In Joomla 4 we have a DIC  (setup code for the database driver is here) https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Service/Provider/Database.php . Your controller is going to be container aware probably (that part hasn’t been done yet) and will have access to this  

 

In tests you have a static instance of the database driver in the SqliteCase and you just inject that when you create the Model instance.

 

The static method calls are removed altogether (will not be supported).

 

3. Collection Implementation

Collection is desired to make interaction with arrays easier and to add functionality special to the Models - relations loading.

 

It needs to implement ArrayAccess, IteratorAggregate. To begin with implement first(), find() and the rest build on the way as we need them.

 

4. Column Alias

 

By default Joomla looks for the state column in the published field. But for banners it’s stored in the state field. This maps the published column to the state column for this component. https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_banners/tables/banner.php#L36

 

Notes: Do in in the Model, getAttribute, setAttrribute.

 

5. passThrough

Introduce passThrough check for Query (due to security issues).