Привет, моя проблема, когда я отправляю форму в торт php, он создает неправильный объект модели.
Я испробовал все возможные решения, но все еще не увенчался успехом, посмотрите мой код
Ниже моя форма PHP-код. Я дал правильное название модели «Цитата», хотя я получаю объект конкурса. Вы также можете увидеть объект, созданный, когда я отправил форму.
<?php echo $this->Form->create('Quote', array('type' => 'file')); ?>
<fieldset>
<legend><?php echo __('Add Quote'); ?></legend>
<?php
echo $this->Form->input('quote');
echo $this->Form->input('author');
echo $this->Form->input('file_name',array('type'=>'file'));
echo $this->Form->input('button_label');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('List Quotes'), array('action' => 'index')); ?></li>
</ul>
После отправки формы ниже объекта создайте вот почему я получил ошибку undefined index: Competition
Объект должен быть создан
Цитировать объект
Competition Object
(
[actsAs] => Array
(
[Sluggable.Sluggable] => Array
(
[label] => title
[slug] => slug
[separator] => -
[overwrite] => 1
)
[Containable] =>
[MeioUpload] => Array
(
[file_name] => Array
(
[dir] => img{DS}widget_images
[create_directory] => 1
[allowed_mime] => Array
(
[0] => image/jpeg
[1] => image/pjpeg
[2] => image/png
[3] => image/gif
)
[allowed_ext] => Array
(
[0] => .jpg
[1] => .jpeg
[2] => .png
[3] => .JPG
[4] => .JPEG
[5] => .PNG
[6] => .gif
[7] => .GIF
)
[default] => default.jpg
)
)
)
[validate] => Array
(
[title] => Array
(
[notEmpty] => Array
(
[rule] => Array
(
[0] => notEmpty
)
)
)
[details] => Array
(
[notEmpty] => Array
(
[rule] => Array
(
[0] => notEmpty
)
)
)
[end_date] => Array
(
[date] => Array
(
[rule] => Array
(
[0] => date
)
)
)
[file_name] => Array
(
[FieldName] => Array
(
[rule] => Array
(
[0] => uploadCheckFieldName
)
[check] => 1
[message] => Este campo não foi definido entre os parâmetros do MeioUploadBehavior.
)
[Dir] => Array
(
[rule] => Array
(
[0] => uploadCheckDir
)
[check] => 1
[message] => O diretório onde este arquivo seria colocado não existe ou é protegido contra escrita.
)
[UploadError] => Array
(
[rule] => Array
(
[0] => uploadCheckUploadError
)
[check] => 1
[message] => There was a problem with that upload.
)
[MaxSize] => Array
(
[rule] => Array
(
[0] => uploadCheckMaxSize
)
[check] => 1
[message] => File exceeds max file size.
)
[InvalidMime] => Array
(
[rule] => Array
(
[0] => uploadCheckInvalidMime
)
[check] => 1
[message] => Invalid mime type.
)
[InvalidExt] => Array
(
[rule] => Array
(
[0] => uploadCheckInvalidExt
)
[check] => 1
[message] => Invalid file extension.
)
)
)
[hasAndBelongsToMany] => Array
(
[User] => Array
(
[className] => User
[joinTable] => competitions_users
[foreignKey] => competition_id
[associationForeignKey] => user_id
[unique] => keepExisting
[conditions] =>
[order] =>
[limit] =>
[offset] =>
[finderQuery] =>
[with] => CompetitionsUser
[dynamicWith] => 1
[fields] =>
)
)
[recursive] => -1
[useDbConfig] => default
[useTable] => competitions
[id] =>
[data] => Array
(
)
[schemaName] => football_new
[table] => competitions
[primaryKey] => id
[_schema:protected] => Array
(
[id] => Array
(
[type] => integer
[null] =>
[default] =>
[length] => 11
[key] => primary
)
[title] => Array
(
[type] => string
[null] =>
[default] =>
[length] => 255
[collate] => latin1_swedish_ci
[charset] => latin1
)
[promo_title] => Array
(
[type] => string
[null] =>
[default] =>
[length] => 255
[collate] => latin1_swedish_ci
[charset] => latin1
)
[details] => Array
(
[type] => text
[null] =>
[default] =>
[length] =>
[collate] => latin1_swedish_ci
[charset] => latin1
)
[end_date] => Array
(
[type] => date
[null] =>
[default] =>
[length] =>
)
[filesize] => Array
(
[type] => integer
[null] =>
[default..
Пожалуйста, предложите мне решение, я очень запутался. Спасибо
Задача ещё не решена.
Других решений пока нет …