本文整理汇总了PHP中Pimcore\Model\Object\Concrete::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Concrete::getClass方法的具体用法?PHP Concrete::getClass怎么用?PHP Concrete::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Object\Concrete
的用法示例。
在下文中一共展示了Concrete::getClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* @param Object\Concrete $object
* @return array
*/
public function load(Object\Concrete $object)
{
$fieldDef = $object->getClass()->getFieldDefinition($this->model->getFieldname());
$values = array();
foreach ($fieldDef->getAllowedTypes() as $type) {
try {
$definition = Object\Objectbrick\Definition::getByKey($type);
} catch (\Exception $e) {
continue;
}
$tableName = $definition->getTableName($object->getClass(), false);
try {
$results = $this->db->fetchAll("SELECT * FROM " . $tableName . " WHERE o_id = ? AND fieldname = ?", array($object->getId(), $this->model->getFieldname()));
} catch (\Exception $e) {
$results = array();
}
//$allRelations = $this->db->fetchAll("SELECT * FROM object_relations_" . $object->getO_classId() . " WHERE src_id = ? AND ownertype = 'objectbrick' AND ownername = ?", array($object->getO_id(), $this->model->getFieldname()));
$fieldDefinitions = $definition->getFieldDefinitions();
$brickClass = "\\Pimcore\\Model\\Object\\Objectbrick\\Data\\" . ucfirst($type);
foreach ($results as $result) {
$brick = new $brickClass($object);
$brick->setFieldname($result["fieldname"]);
$brick->setObject($object);
foreach ($fieldDefinitions as $key => $fd) {
if (method_exists($fd, "load")) {
// datafield has it's own loader
$value = $fd->load($brick);
if ($value === 0 || !empty($value)) {
$brick->setValue($key, $value);
}
} else {
if (is_array($fd->getColumnType())) {
$multidata = array();
foreach ($fd->getColumnType() as $fkey => $fvalue) {
$multidata[$key . "__" . $fkey] = $result[$key . "__" . $fkey];
}
$brick->setValue($key, $fd->getDataFromResource($multidata));
} else {
$brick->setValue($key, $fd->getDataFromResource($result[$key]));
}
}
}
$setter = "set" . ucfirst($type);
$this->model->{$setter}($brick);
$values[] = $brick;
}
}
return $values;
}
示例2: save
/**
* @param Model\Object\Concrete $object
* @throws \Exception
*/
public function save(Model\Object\Concrete $object)
{
$tableName = $this->model->getDefinition()->getTableName($object->getClass());
$data = array("o_id" => $object->getId(), "index" => $this->model->getIndex(), "fieldname" => $this->model->getFieldname());
try {
foreach ($this->model->getDefinition()->getFieldDefinitions() as $fd) {
$getter = "get" . ucfirst($fd->getName());
if (method_exists($fd, "save")) {
// for fieldtypes which have their own save algorithm eg. objects, multihref, ...
$fd->save($this->model);
} else {
if ($fd->getColumnType()) {
if (is_array($fd->getColumnType())) {
$insertDataArray = $fd->getDataForResource($this->model->{$getter}(), $object);
$data = array_merge($data, $insertDataArray);
} else {
$data[$fd->getName()] = $fd->getDataForResource($this->model->{$getter}(), $object);
}
}
}
}
$this->db->insert($tableName, $data);
} catch (\Exception $e) {
throw $e;
}
}
示例3: delete
/**
* @throws \Exception
* @param Object\Concrete $object
* @return void
*/
public function delete(Object\Concrete $object)
{
// this is to clean up also the inherited values
$fieldDef = $object->getClass()->getFieldDefinition($this->model->getFieldname());
foreach ($fieldDef->getAllowedTypes() as $type) {
try {
$definition = Object\Objectbrick\Definition::getByKey($type);
} catch (\Exception $e) {
continue;
}
$tableName = $definition->getTableName($object->getClass(), true);
$this->db->delete($tableName, "o_id = " . $object->getId());
}
}
示例4: getDataForObject
private function getDataForObject(Object\Concrete $object, $objectFromVersion = false)
{
foreach ($object->getClass()->getFieldDefinitions() as $key => $def) {
$this->getDataForField($object, $key, $def, $objectFromVersion);
}
}
示例5: delete
/**
* @param Object\Concrete $object
* @return void
*/
public function delete(Object\Concrete $object)
{
// update data for store table
$storeTable = $this->model->getDefinition()->getTableName($object->getClass(), false);
$this->db->delete($storeTable, $this->db->quoteInto("o_id = ?", $object->getId()));
// update data for query table
$queryTable = $this->model->getDefinition()->getTableName($object->getClass(), true);
$oldData = $this->db->fetchRow("SELECT * FROM " . $queryTable . " WHERE o_id = ?", $object->getId());
$this->db->delete($queryTable, $this->db->quoteInto("o_id = ?", $object->getId()));
//update data for relations table
$this->db->delete("object_relations_" . $object->getClassId(), "src_id = " . $object->getId() . " AND ownertype = 'objectbrick' AND ownername = '" . $this->model->getFieldname() . "' AND position = '" . $this->model->getType() . "'");
$this->inheritanceHelper = new Object\Concrete\Dao\InheritanceHelper($object->getClassId(), "o_id", $storeTable, $queryTable);
$this->inheritanceHelper->resetFieldsToCheck();
$objectVars = get_object_vars($this->model);
foreach ($objectVars as $key => $value) {
$fd = $this->model->getDefinition()->getFieldDefinition($key);
if ($fd) {
if ($fd->getQueryColumnType()) {
//exclude untouchables if value is not an array - this means data has not been loaded
//get changed fields for inheritance
if ($fd instanceof Object\ClassDefinition\Data\CalculatedValue) {
continue;
}
if ($fd->isRelationType()) {
if ($oldData[$key] != null) {
$this->inheritanceHelper->addRelationToCheck($key, $fd);
}
} else {
if ($oldData[$key] != null) {
$this->inheritanceHelper->addFieldToCheck($key, $fd);
}
}
if (method_exists($fd, "delete")) {
$fd->delete($object);
}
}
}
}
$this->inheritanceHelper->doDelete($object->getId());
$this->inheritanceHelper->resetFieldsToCheck();
}
示例6: getSuperLayoutDefinition
/** Calculates the super layout definition for the given object.
* @param Concrete $object
* @return mixed
*/
public static function getSuperLayoutDefinition(Concrete $object)
{
$masterLayout = $object->getClass()->getLayoutDefinitions();
$superLayout = unserialize(serialize($masterLayout));
self::createSuperLayout($superLayout);
return $superLayout;
}
示例7: doGetInheritedValues
/**
* @static
* @return bool
*/
public static function doGetInheritedValues(Concrete $object = null)
{
if (self::$getInheritedValues && $object !== null) {
$class = $object->getClass();
return $class->getAllowInherit();
}
return self::$getInheritedValues;
}
示例8: delete
/**
* @param Object\Concrete $object
*/
public function delete(Object\Concrete $object)
{
// empty or create all relevant tables
$fieldDef = $object->getClass()->getFieldDefinition($this->model->getFieldname());
foreach ($fieldDef->getAllowedTypes() as $type) {
try {
$definition = Object\Fieldcollection\Definition::getByKey($type);
} catch (\Exception $e) {
continue;
}
$tableName = $definition->getTableName($object->getClass());
try {
$this->db->delete($tableName, $this->db->quoteInto("o_id = ?", $object->getId()) . " AND " . $this->db->quoteInto("fieldname = ?", $this->model->getFieldname()));
} catch (\Exception $e) {
// create definition if it does not exist
$definition->createUpdateTable($object->getClass());
}
}
// empty relation table
$this->db->delete("object_relations_" . $object->getClassId(), "ownertype = 'fieldcollection' AND " . $this->db->quoteInto("ownername = ?", $this->model->getFieldname()) . " AND " . $this->db->quoteInto("src_id = ?", $object->getId()));
}
示例9: delete
/**
* @param Object\Concrete $object
*/
public function delete(Object\Concrete $object)
{
// empty or create all relevant tables
$fieldDef = $object->getClass()->getFieldDefinition($this->model->getFieldname());
foreach ($fieldDef->getAllowedTypes() as $type) {
try {
/** @var $definition Definition */
$definition = Object\Fieldcollection\Definition::getByKey($type);
} catch (\Exception $e) {
continue;
}
$tableName = $definition->getTableName($object->getClass());
try {
$this->db->delete($tableName, $this->db->quoteInto("o_id = ?", $object->getId()) . " AND " . $this->db->quoteInto("fieldname = ?", $this->model->getFieldname()));
} catch (\Exception $e) {
// create definition if it does not exist
$definition->createUpdateTable($object->getClass());
}
if ($definition->getFieldDefinition("localizedfields")) {
$tableName = $definition->getLocalizedTableName($object->getClass());
try {
$this->db->delete($tableName, $this->db->quoteInto("ooo_id = ?", $object->getId()) . " AND " . $this->db->quoteInto("fieldname = ?", $this->model->getFieldname()));
} catch (\Exception $e) {
\Logger::error($e);
}
}
$childDefinitions = $definition->getFielddefinitions();
if (is_array($childDefinitions)) {
foreach ($childDefinitions as $fd) {
if (method_exists($fd, "delete")) {
$fd->delete($object, ["context" => ["containerType" => "fieldcollection", "containerKey" => $type, "fieldname" => $this->model->getFieldname()]]);
}
}
}
}
// empty relation table
$this->db->delete("object_relations_" . $object->getClassId(), "(ownertype = 'fieldcollection' AND " . $this->db->quoteInto("ownername = ?", $this->model->getFieldname()) . " AND " . $this->db->quoteInto("src_id = ?", $object->getId()) . ")" . " OR (ownertype = 'localizedfield' AND " . $this->db->quoteInto("ownername LIKE ?", "/fieldcollection~" . $this->model->getFieldname() . "/%") . ")");
}
示例10: performFieldcollectionModificationCheck
public function performFieldcollectionModificationCheck(Object\Concrete $object, $originalModificationDate, $data)
{
$modificationDate = $this->getParam("modificationDate");
if ($modificationDate != $originalModificationDate) {
$fielddefinitions = $object->getClass()->getFieldDefinitions();
foreach ($fielddefinitions as $fd) {
if ($fd instanceof Object\ClassDefinition\Data\Fieldcollections) {
if (isset($data[$fd->getName()])) {
$allowedTypes = $fd->getAllowedTypes();
foreach ($allowedTypes as $type) {
/** @var $fdDef Object\Fieldcollection\Definition */
$fdDef = Object\Fieldcollection\Definition::getByKey($type);
$childDefinitions = $fdDef->getFieldDefinitions();
foreach ($childDefinitions as $childDef) {
if ($childDef instanceof Object\ClassDefinition\Data\Localizedfields) {
$this->_helper->json(["success" => false, "message" => "Could be that someone messed around with the fieldcollection in the meantime. Please reload and try again"]);
}
}
}
}
}
}
}
}
示例11: checkcredential
protected function checkcredential(Concrete $identity)
{
/** @var \Pimcore\Model\Object\ClassDefinition\Data\Password $credentialField */
$credentialField = $identity->getClass()->getFieldDefinition($this->credentialColumn);
$hashed = $credentialField->getDataForResource($this->credential);
return $hashed === $identity->{$this->credentialColumn};
}