?
avatar shahryarjb
shahryarjb
1 Jul 2018

I want to try to create Json restful, but I have a problem with Joomla ORM, for example in elixir language in Ecto ORM , we can write types

schema "cms_post" do
  field :title, :string, null: false
  field :status, :boolean, null: false
  field :post_type, :string, null: false
  field :download_ext_link, :string, null: false
  field :price, :string, default: "0", null: false
  field :pic_x1_link, :string, null: false
end

@all_fields ~w(title status post_type download_ext_link price pic_x1_link pic_x2_link pic_x3_link group_acl description changelog changelog_category plugin plugin_category discourse discourse_link screen_shot screen_shot_category learn learn_category seo_tag seo_alias_link seo_words seo_description seo_language seo_language_link cms_post_category_id)a

def changeset(struct, params \\ %{}) do
    struct
    |> cast(params, @all_fields)
    |> validate_required(@all_fields)
    |> unique_constraint(:seo_alias_link, name: :index_of_post_alias_unique_link, message: "alias link already exists.")
    |> validate_inclusion(:seo_language, ["en", "fa"])
    |> validate_inclusion(:group_acl, ["admin", "actived", "unactived", "blocked"])
    |> validate_inclusion(:post_type, ["article", "shop", "free"])
    |> validate_length(:title, min: 3, max: 100)
    |> validate_length(:description, min: 100)
    |> validate_length(:seo_words, min: 3, max: 100)
    |> validate_length(:seo_description, min: 50, max: 264)
    |> foreign_key_constraint(:cms_post_category_id)
    |> validate_field_relational(:cms_post_category_id)
end

if you see that code in elixir Ecto , you will know, all error of user request are processed by ORM and Json web service router can handle it , but in Joomla I don't have any option for creating handle web service well, therefore it takes me for long time to create web service in Joomla.

it is clear that Elixir is a modern language , but Ecto just is a library which is created by elixir community.

Joomla developers can't create big work until Joomla will want to do these. Joomla is a framework laravel too or Phoenix.

Thank you.

https://hexdocs.pm/ecto/Ecto.html

avatar shahryarjb shahryarjb - open - 1 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Jul 2018
avatar shahryarjb shahryarjb - change - 1 Jul 2018
The description was changed
avatar shahryarjb shahryarjb - edited - 1 Jul 2018
avatar shahryarjb shahryarjb - change - 1 Jul 2018
The description was changed
avatar shahryarjb shahryarjb - edited - 1 Jul 2018
avatar shahryarjb shahryarjb - change - 1 Jul 2018
The description was changed
avatar shahryarjb shahryarjb - edited - 1 Jul 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Jul 2018
Category Feature Request JavaScript
avatar Fedik
Fedik - comment - 1 Jul 2018

just a question,
how it related to Joomla? it even not PHP

I want to try to create Json restful

for this you need to create a component in Joomla, If I right understood your question.

avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Jul 2018
Status New Discussion
avatar shahryarjb
shahryarjb - comment - 1 Jul 2018

Hello @Fedik , you think all of these are for the sake of Elixir Language ? Im not sure , because Php have many power too.

for this you need to create a component in Joomla, If I right understood your question.

Yes, I need to create multi component and integration Joomla to mobile app or react app and ... , but I have no more option in Joomla for these. for this purpose :

it takes me for long time to create web service in Joomla.

I have to write more code and I need more time to create one web service .

by the way in laravel the developer have a magic tools for creating MVC , this tools may be for create new component in Joomla

I think the Joomla which is one of the best cms of the world should do different option in the its cms for developers, in the all of version which were released , Joomla tries to say that it is just a cms not a framework .

Thanks , I hope Joomla always is good. Especially that the Joomla4 is coming soon.

Please see : https://laravel.com/docs/5.6/eloquent

Capsule::schema()->create('todos', function ($table) {

       $table->increments('id');

       $table->string('todo');

       $table->string('description');

       $table->string('category');

       $table->integer('user_id')->unsigned();

       $table->timestamps();

       $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

   });
avatar wilsonge wilsonge - change - 1 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-01 15:49:13
Closed_By wilsonge
avatar wilsonge
wilsonge - comment - 1 Jul 2018

We're working on our own ORM in J4 - WIP at https://github.com/joomla-projects/entities

Given this post is largely just advertising other frameworks I'm going to close this. If you want to bring up specific issues about the orm - please do so in the entity repo

avatar wilsonge wilsonge - close - 1 Jul 2018
avatar shahryarjb
shahryarjb - comment - 1 Jul 2018

@wilsonge now a days, we advertise when the system needs a better way . interesting !!!!

avatar wilsonge
wilsonge - comment - 1 Jul 2018

I've given you a link to our WIP at doing this better - so of course that means we are working on a better way and that we accept the current system needs improving.

Add a Comment

Login with GitHub to post a comment