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

Bug: Fields with alias not converted to their type #145

Closed
FlipEverything opened this issue Nov 16, 2015 · 3 comments
Closed

Bug: Fields with alias not converted to their type #145

FlipEverything opened this issue Nov 16, 2015 · 3 comments

Comments

@FlipEverything
Copy link
Contributor

I have this Entity:

class Email extends \Spot\Entity
{
  public static function fields()
  {
    return [
   ...
      'replyTo' => ['type' => 'array', 'column' => 'reply_to'],
      'to' => ['type' => 'array'],
   ...
    ];
  }
}

As you can see, there are two fields with the type of 'array'. One of them is aliased. The aliased one returns with a string instead of an array():

object(\Entity\Email)[29]
...
  protected '_data' => 
    array (size=17)
    ...
      'replyTo' => string 'a:1:{i:0;s:20:"some_email@gmail.com";}' (length=53)
      'to' => 
        array (size=1)
          0 => string 'some_email@gmail.com' (length=20)
    ... 
...

If I remove the alias it works properly. I could not find where it is translated from the database value to the php value.

@FlipEverything
Copy link
Contributor Author

I think the aliased field's 'default' property is broken too.

@vlucas
Copy link
Collaborator

vlucas commented Jan 6, 2016

I'll have to make a test for this to take a look.

@FlipEverything
Copy link
Contributor Author

Where can I find the alias management in the code?

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