Saving Array question #43

Closed
Gorbov opened this Issue Oct 16, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

Gorbov commented Oct 16, 2012

How can I save an array of user's email?

$emails = array('aa@aa.com','bb@bb.com', ...)

or, for example,
currency array
$currs = array('USD','EUR', ...)

I mean, witch Property Type?
...
->addProperty(new \morph\property\ {...} ('emails'))
...

Is it possible?

Hi,

I have made something alike with an ->addProperty(new \morph\property\Generic("names"), array())

Owner

a-musing-moose commented Jan 7, 2013

Hi,

Have you looked at the StatefulCollection property. It acts like an array.

The problem with just using the generic property with an array is that addtions/removals etc from the array do not trigger a state change in the model, and therefore it won't know that it is dirty and needs saving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment