Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

The noun specified could not be singularized

posted by anonymous 8 years ago

how can i get rid of this, it give me troubles, because i dont kave name of tables in english, and a i change and mapping class to table but when i have foreign key in schema still appears.

posted by wbond 8 years ago

so whete i put this i have something like

 $schema = fORMSchema::retrieve();
            $tables = $schema->getTables();
            $related = ($schema->getRelationships(strtolower($class)));
            //$table  = self::tablize($class);
            fORM::mapClassToTable(ucfirst($class), strtolower($class));
            foreach ($related as $value) {
                if (count($value) > 0) {
                    fORM::mapClassToTable(ucfirst($value[0]["related_table"]), ($value[0]["related_table"]));
                }
            }
            if (in_array(strtolower($class), $tables)) {
                eval('class ' . $class . ' extends Transparentrecords { };');
                return;
            }

            throw new fProgrammerException(
                    'The class specified, %s, does not correspond to a database table',
                    $class
            );
posted by anonymous 8 years ago
static public function defineActiveRecordClass($class, $options = array()) {

        if (class_exists($class, FALSE)) {
            return;
        }if (count($options) > 0) {
            $schema = fORMSchema::retrieve();
            $tables = $schema->getTables();
            $related = ($schema->getRelationships(strtolower($class)));
            //$table  = self::tablize($class);
            fORM::mapClassToTable(ucfirst($class), strtolower($class));
            foreach ($related as $value) {
                if (count($value) > 0) {
                    fORM::mapClassToTable(ucfirst($value[0]["related_table"]), ($value[0]["related_table"]));
                }
            }
            if (in_array(strtolower($class), $tables)) {
                eval('class ' . $class . ' extends Transparentrecords { public function configure() {
                    fORMFile::configureFileUploadColumn($this, "pdf", $_SERVER["DOCUMENT_ROOT"] . "/PhpProject1/public/uploads/");
                    }
                    }');
                return;
            }

            throw new fProgrammerException(
                    'The class specified, %s, does not correspond to a database table',
                    $class
            );
        } else {
            $schema = fORMSchema::retrieve();
            $tables = $schema->getTables();
            $related = ($schema->getRelationships(strtolower($class)));
            //$table  = self::tablize($class);
            fORM::mapClassToTable(ucfirst($class), strtolower($class));
            foreach ($related as $value) {
                if (count($value) > 0) {
                    fORM::mapClassToTable(ucfirst($value[0]["related_table"]), ($value[0]["related_table"]));
                }
            }
            if (in_array(strtolower($class), $tables)) {
                eval('class ' . $class . ' extends Transparentrecords { };');
                return;
            }

            throw new fProgrammerException(
                    'The class specified, %s, does not correspond to a database table',
                    $class
            );
        }
posted by anonymous 8 years ago