# |
May 31st 2016, 09:03 |
birdy247 |
Neon1024 I think I know why |
# |
May 31st 2016, 09:03 |
Neon1024 |
Or probably, $this->PrimaryTables->RelatedTables->newEntity() |
# |
May 31st 2016, 09:03 |
unorthodox |
Facepalm |
# |
May 31st 2016, 09:03 |
Neon1024 |
unorthodox, $entity->related = $this->Relateds->newEntity($data) |
# |
May 31st 2016, 09:02 |
unorthodox |
@neon1024: Any clue mate? |
# |
May 31st 2016, 09:01 |
birdy247 |
well its giving me an exception :yum: |
# |
May 31st 2016, 09:01 |
Neon1024 |
https://github.com/davidyell/CakePHP3-Proffer/blob/v0.4.2/docs/configuration.md#configuring-the-behaviour-in-your-table |
# |
May 31st 2016, 09:00 |
birdy247 |
lol |
# |
May 31st 2016, 09:00 |
Neon1024 |
Nah, I like debug output in production :p |
# |
May 31st 2016, 09:00 |
birdy247 |
? |
# |
May 31st 2016, 09:00 |
birdy247 |
without the var_dump |
# |
May 31st 2016, 08:59 |
Neon1024 |
birdy247, Itâ??s what my project uses |
# |
May 31st 2016, 08:59 |
birdy247 |
so is this definatly the finished script? |
# |
May 31st 2016, 08:59 |
Neon1024 |
The way it works in _initializeSchema is not a static call |
# |
May 31st 2016, 08:59 |
unorthodox |
$entity->related is not yet an entity though. |
# |
May 31st 2016, 08:59 |
birdy247 |
but there was still some var_dump in there |
# |
May 31st 2016, 08:59 |
birdy247 |
I did :slightly_smiling_face: |
# |
May 31st 2016, 08:59 |
Neon1024 |
So copy mine |
# |
May 31st 2016, 08:59 |
Neon1024 |
Iâ??ve not tried it on a date type though |
# |
May 31st 2016, 08:58 |
birdy247 |
it is a datetime though |
# |
May 31st 2016, 08:58 |
Neon1024 |
Type::map('date', 'App\Database\Type\TimezoneAwareDateTimeType'); |
# |
May 31st 2016, 08:58 |
birdy247 |
Call to a member function timezone() on null |
# |
May 31st 2016, 08:57 |
Neon1024 |
I guess perhaps there might be a use-case though where +12 would be the next day |
# |
May 31st 2016, 08:57 |
Neon1024 |
Which makes timezone rather irrelevant imho |
# |
May 31st 2016, 08:57 |
Neon1024 |
Yeah, so you want to marshall â??dateâ?? types |
# |
May 31st 2016, 08:57 |
Neon1024 |
Usually from the db schema |
# |
May 31st 2016, 08:56 |
birdy247 |
$schema->columnType('date', 'timezone'); |
# |
May 31st 2016, 08:56 |
Neon1024 |
The â??Typeâ?? is the type of data |
# |
May 31st 2016, 08:56 |
Neon1024 |
Think datetime, date, string, integer |
# |
May 31st 2016, 08:56 |
Neon1024 |
I doubt timezone is a valid data type |
# |
May 31st 2016, 08:56 |
birdy247 |
I was using the _initializeSchema to set it |
# |
May 31st 2016, 08:56 |
Neon1024 |
birdy247, Well youâ??re telling the marshaller that for data type â??timezoneâ?? use this class |
# |
May 31st 2016, 08:55 |
birdy247 |
is my name wrong? |
# |
May 31st 2016, 08:55 |
Neon1024 |
unorthodox: $entity->related->set(â??fieldâ??, $value) |
# |
May 31st 2016, 08:55 |
birdy247 |
Type::map('timezone', 'App\Database\Type\TimezoneAwareDateTimeType'); |
# |
May 31st 2016, 08:55 |
Neon1024 |
Just before, Type::build('datetime')->useLocaleParser(); |
# |
May 31st 2016, 08:55 |
unorthodox |
How i can modify an associated entity on `beforeSave()`, and apparently after i `patchedEntity` ? |
# |
May 31st 2016, 08:55 |
Neon1024 |
In my bootstrap.php |
# |
May 31st 2016, 08:55 |
Neon1024 |
Type::map('datetime', 'App\Database\Type\TimezoneAwareDateTimeType'); |
# |
May 31st 2016, 08:54 |
Neon1024 |
"cakephp/cakephp": "^3.2", |
# |
May 31st 2016, 08:54 |
birdy247 |
this is 3.2.10 |