Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTools: models generated with no namespace specified are broken because line is not omitted #1467

Closed
gianks opened this issue Jul 28, 2020 · 2 comments
Assignees
Milestone

Comments

@gianks
Copy link

gianks commented Jul 28, 2020

Questions should go to https://forum.phalconphp.com
Documentation issues should go to https://github.com/phalcon/docs/issues

Expected and Actual Behavior

Generate Models from Database Tables with WebTools without specifing a namespace

Provide output if related

[error] Uncaught exception: syntax error, unexpected ';', expecting '{' in /var/www/bw/app/models/ActivationToken.php on line 3

Provide minimal script to reproduce the issue

Add to any PHP file the generated line: 

namespace ;

Details

  • System info and versions (if possible): (phalcon info)
Phalcon DevTools (4.0.3)

Environment:
  OS: Linux BW 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
  PHP Version: 7.3.19-1~deb10u1
  PHP SAPI: cli
  PHP Bin: /usr/bin/php7.3
  PHP Extension Dir: /usr/lib/php/20180731
  PHP Bin Dir: /usr/bin
  Loaded PHP config: /etc/php/7.3/cli/php.ini
Versions:
  Phalcon DevTools Version: 4.0.3
  Phalcon Version: 4.0.6
  AdminLTE Version: 2.3.6

* Phalcon Framework version: (`php --ri phalcon`)
Version => 4.0.6
Build Date => May 16 2020 18:33:07
Powered by Zephir => Version 0.12.17-6724dbf

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.case_insensitive_column_map => Off => Off
phalcon.orm.cast_last_insert_id_to_int => Off => Off
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.column_renaming => On => On
phalcon.orm.disable_assign_setters => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.enable_literals => On => On
phalcon.orm.events => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.exception_on_failed_metadata_save => On => On
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.not_null_validations => On => On
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.warning.enable => On => On
  • PHP Version:
PHP 7.3.19-1~deb10u1 (cli) (built: Jul  5 2020 06:46:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.19, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.19-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
  • Operating System:
Debian 10.4
  • Server: Nginx
  • Other related info (Database, table schema): MariaDB

My Easy Fix (run it in models folder after generation):

find ./ -prinf '%p' -type f -exec send -i -n '/namespace ;/!p' {} \;
@BeMySlaveDarlin
Copy link
Contributor

Added empty string checks on namespace templating

@Jeckerson
Copy link
Member

Fixed in #1496

@Jeckerson Jeckerson mentioned this issue Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants