Skip to content

Slugging and translations #54

@lupuswwww

Description

@lupuswwww

In the application I am working on, I can fetch records in the default language without any problems, but I am unable to do so in the translated languages. A simplified PHP code looks like this:

public function index($slug=null)
{
$this->ServiceUnits = $this->fetchTable('ServiceUnits');
$serviceUnit = $this->ServiceUnits->find('slugged', slug: $slug)->first();
}

CREATE TABLE IF NOT EXISTS service_units (
id int NOT NULL AUTO_INCREMENT,
title varchar(255) DEFAULT NULL,
text text,
slug varchar(100) DEFAULT NULL,
active tinyint(1) NOT NULL DEFAULT '0',
position float DEFAULT NULL,
PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS service_units_translations (
id int NOT NULL,
locale varchar(5) NOT NULL,
title varchar(255) DEFAULT NULL,
text text,
slug varchar(100) DEFAULT NULL,
PRIMARY KEY (id,locale)
);

How can I retrieve data from the service_units_translations table using the 'Slug' plugin?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions