本文整理汇总了PHP中Object::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::toArray方法的具体用法?PHP Object::toArray怎么用?PHP Object::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::toArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duplicateLayout
/**
* Duplicate given object and copy files needed.
* @param Object $origLayout
*/
public function duplicateLayout($origLayout)
{
// Convert the orig layout to an array
$origData = $origLayout->toArray();
// Store this for later use
$origType = $origData['layout_type'];
// Unset pieces not needed and reset some pieces
unset($origData['layout_id']);
$origData['layout_type'] = Layouts_Model_Layout::CUSTOM;
$layoutPath = $this->fetchLayoutPath($origType, $origData['layout_module']);
// Set our source file
$sourceFile = $layoutPath . $origLayout->createFilename($origData['layout_title_orig']);
// New Path
$newPath = $this->fetchLayoutPath(Layouts_Model_Layout::CUSTOM, $origData['layout_module']);
// Make sure we don't have the same filename
while (is_file($newPath . $origData['layout_filename'])) {
$origData['layout_title'] .= ' copy';
$origData['layout_filename'] = $origLayout->createFilename($origData['layout_title']);
}
$newFile = $newPath . $origData['layout_filename'];
// Do the copy
$copyResult = copy($sourceFile, $newFile);
if (!$copyResult) {
throw new FFR_Model_Exception('There was a problem copying the file.');
}
// Save the new DB record
$newLayout = $this->create($origData);
$newLayout->save();
return true;
}
示例2: toArray
/**
* @return array
*/
public function toArray()
{
$array = parent::toArray();
$array['cells'] = array_map(function ($cell) {
return $cell->toArray();
}, $this->cells);
return $array;
}
示例3: prepareParams
/**
* Prepare params.
*
* @return array $params
*/
private function prepareParams()
{
$params = array_merge(['loginemail' => self::$loginemail, 'password' => self::$password], $this->object->toArray(), ['thumbnail";filename="' . $this->object->getThumbnail()->getFilename() => $this->object->getThumbnail()->getData()]);
if ($this->object->getSubimage()) {
foreach ($this->object->getSubimage() as $image) {
$params['subimage[]";filename="' . $image->getFilename()] = $image->getData();
}
}
return $params;
}
示例4: send
/**
* Send object.
*
* @param bool $isTest
*
* @return bool
*
* @throws TransportException
* @throws InvalidParamException
* @throws ImageException
*/
public function send($isTest = false)
{
$params = $this->object->toArray();
$aboutme = $params['aboutme'];
unset($params['aboutme']);
if ($isTest) {
return true;
}
$this->object->setUploadedLink();
$response = $this->request(self::$url . self::$registerApi, $params);
$params = ['token' => $response['data']['token']];
$params['property'] = 'aboutme';
$params['value'] = $aboutme;
$this->request(self::$url . self::$aboutmeApi, $params);
/*if ($this->object->getThumbnail()) {
$photo = $this->object->getThumbnail();
$response = $this->request(self::$url . self::$uploadApi, ['file' => new \CURLFile($photo->getLocalFile())]);
$this->request(self::$url . self::$photoApi, ['token' => $response['data']['token'], 'photo' => $response]);
}*/
return true;
}
示例5: toArray
public function toArray()
{
$array = parent::toArray();
if (array_key_exists('Cheaters', $array)) {
$array = array_merge($array, $array['Cheaters']);
}
return $array;
}
示例6: toArray
public function toArray()
{
// remove sensitive stuff
return array_diff_key(parent::toArray(), array("id" => true, "password" => true));
}
示例7: toArray
/**
* @return array
*/
public function toArray()
{
$header = $this->getHeader();
$rows = $this->getRows();
$c_header = count($header);
$c_rows = !empty($rows) ? max(array_map('count', $rows)) : 0;
$c_max = max($c_header, $c_rows);
$header = self::fillRow($header, $c_max)->toArray();
$rows = array_map(function ($row) use($c_max) {
return self::fillRow($row, $c_max)->toArray();
}, $rows);
$array = parent::toArray();
$array['header'] = $header;
$array['rows'] = $rows;
return $array;
}