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

[part] ORM Table annotation #14

Closed
gildonei opened this issue Mar 14, 2019 · 10 comments
Closed

[part] ORM Table annotation #14

gildonei opened this issue Mar 14, 2019 · 10 comments
Assignees
Labels
bug documentation Changes, improvements in the documentation Fixed Fixed bug

Comments

@gildonei
Copy link
Contributor

Steps

  1. Created a table pessoas in MySQL (lower case name)
  2. Created a model named Pessoas with web-tools
  3. Set @table("pessoas") annotation in model Pessoas
  4. Run cache tool on web-tools

Expected Result

Succefull message

Actual Result

Message : Uncaught mindplay\annotations\AnnotationException: Ubiquity\annotations\TableAnnotation::$0 is not a valid property name in C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php:29 Stack trace: #0 C:\wamp64\www\ubiquity\html\vendor\phpmv\ubiquity\src\Ubiquity\annotations\BaseAnnotation.php(41): mindplay\annotations\Annotation->__get('0') #1 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(296): Ubiquity\annotations\BaseAnnotation->initAnnotation(Array) #2 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(263): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'class') #3 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(594): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'property', '$id') #4 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotations.php(90): mindplay\an
File : C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php
Line : 29

Versions

  • Ubiquity framework 2.0.11
  • Ubiquity devtools 1.1.6
  • php 7.1.9
  • Windows 10 (wamp 3.5)

Pessoas model

<?php
namespace controllers;

use Ubiquity\orm\DAO;

/**
 * Controller Pessoas
 **/
class Pessoas extends ControllerBase
{
@jcheron
Copy link
Contributor

jcheron commented Mar 14, 2019

your model is not a model!

?php
namespace controllers;

use Ubiquity\orm\DAO;

/**
 * Controller Pessoas
 **/
class Pessoas extends ControllerBase
{

@gildonei
Copy link
Contributor Author

Sorry, copied from wrong file

<?php
namespace models;

/**
 * @table(pessoas)
 */
class Pessoas
{

    /**
     * @id
     * @column("name"=>"id","nullable"=>false,"dbType"=>"int(11)")
     * @validator("id","constraints"=>array("autoinc"=>true))
     * */
    private $id;

    /**
     * @column("name"=>"ds_nome","nullable"=>false,"dbType"=>"varchar(100)")
     * @validator("length","constraints"=>array("max"=>100,"notNull"=>true))
     * */
    private $ds_nome;

@gildonei
Copy link
Contributor Author

I also tried

/**
 * @table("pessoas")
 */
/**
 * @Table("pessoas")
 */
/**
 * @ORM\Table("pessoas")
 */
/**
 * @table(name="pessoas")
 */

@jcheron
Copy link
Contributor

jcheron commented Mar 14, 2019

it's @table("pessoas")
not @table(pessoas)
you forgot the quotation marks?

@gildonei
Copy link
Contributor Author

no i didn't, also tried with same error

@gildonei
Copy link
Contributor Author

<?php
namespace models;

/**
 * @table("pessoas")
 */
class Pessoas
{
Error
Message : Uncaught mindplay\annotations\AnnotationException: Ubiquity\annotations\TableAnnotation::$0 is not a valid property name in C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php:29 Stack trace: #0 C:\wamp64\www\ubiquity\html\vendor\phpmv\ubiquity\src\Ubiquity\annotations\BaseAnnotation.php(41): mindplay\annotations\Annotation->__get('0') #1 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(297): Ubiquity\annotations\BaseAnnotation->initAnnotation(Array) #2 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(264): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'class') #3 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\AnnotationManager.php(595): mindplay\annotations\AnnotationManager->getAnnotations('models\\Pessoas', 'property', '$id') #4 C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotations.php(90): mindplay\an
File : C:\wamp64\www\ubiquity\html\vendor\mindplay\annotations\src\annotations\Annotation.php
Line : 29

Also tried to add option table in AnnotationManager.php returning the TableAnnotation.php as it source and didn't work

@jcheron
Copy link
Contributor

jcheron commented Mar 14, 2019

Sorry, it's:

@table("name"=>"pessoas")

@gildonei
Copy link
Contributor Author

OK, It works! How can I update the docs?

@gildonei
Copy link
Contributor Author

Found! Docs updated too

@jcheron jcheron added bug documentation Changes, improvements in the documentation labels Mar 15, 2019
@jcheron jcheron closed this as completed Mar 15, 2019
@jcheron
Copy link
Contributor

jcheron commented Mar 15, 2019

Thanks for the correction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation Changes, improvements in the documentation Fixed Fixed bug
Projects
None yet
Development

No branches or pull requests

2 participants