Get migration path.

@param  \Illuminate\Database\Eloquent\Model|null  $entity

@return array|null
967009
public function getMigrationPaths(Model $entity = null): ?array
    {
        if (! \is_null($entity) && isset($this->migrationPaths[$entity->getKey()])) {
            return $this->migrationPaths[$entity->getKey()];
        }

        return $this->getDefaultMigrationPaths();
    }
777495
public function path(EntityInterface $entity, array $options = []) {
		$config = array_merge($this->getConfig(), $options);
		$path = '';
		$path = $this->_pathPrefix($entity, $path, $config);
		$path = $this->_path($entity, $path, $config);
		$path = $this->_pathSuffix($entity, $path, $config);

		return $this->ensureSlash($path, 'after');
	}
507221
private function getMeta($entity)
    {
        $parts  = explode('\\', $entity);
        $entity = array_pop($parts);

        if ($entity[0] == '@') {
            // Indirect entity definition; skip
            return null;
        }

        if (!isset($this->entityDefinitions[$entity])) {
            // Unknown entity definition; skip
            return null;
        }

        return $this->entityDefinitions[$entity];
    }
227127
public function deleteTranslationData($entity)
    {
        $metadata = $this->metadataCollection->getMetadata($entity);
        if($metadata === null) {
            return null;
        }

        $strategies = $this->strategyResolver->getStrategies();
        foreach($strategies as $strategy) {
            $strategy->deleteTranslationData($entity, $metadata);
        }
    }
402983
public function returnUrlForEntity(Entity $entity) {
		return Router::url(
			[
				'plugin' => null,
				'prefix' => null,
				'controller' => $this->_table->alias(),
				'action' => 'view',
				$entity->{$this->_table->primaryKey()},
			],
			true
		);
	}
410011
public function getPositionFieldByEntity($entity)
	{
		if (is_object($entity)) {
			$entity = \Doctrine\Common\Util\ClassUtils::getClass($entity);
		}

		if (isset($this->positionField['entities'][$entity])) {
			return $this->positionField['entities'][$entity];
		} else {
			return $this->positionField['default'];
		}
	}
642349
protected function getEntityTable($entity)
    {
        if (!$entity instanceof EntityInterface) {
            $entity = $this->getEntityClass($entity);
        }
        return $this->tablePrefix . $entity::getTable() . $this->tableSuffix;
    }
125467
protected function _getOldValues(Entity $entity)
    {
        $config = $this->getConfig();
        $fields = array_merge($config['scope'], [$config['order']]);

        $values = [];
        foreach ($fields as $field) {
            if ($entity->isDirty($field)) {
                $values[$field] = $entity->getOriginal($field);
            } elseif ($entity->has($field)) {
                $values[$field] = $entity->get($field);
            }
        }

        if (count($fields) != count($values)) {
            $primaryKey = $entity->get($this->_table->getPrimaryKey());
            $entity = $this->_table->get($primaryKey, ['fields' => $fields]);
            $values = $entity->extract($fields);
        }

        $order = $values[$config['order']];
        unset($values[$config['order']]);

        return [$order, $values];
    }
132627
public function article($entity)
    {
        if (!$entity->displayArticleMetaTags) {
            return '';
        }

        $attributes = [
            'article:publisher' => Configure::read('Settings.Cms.SEO.Social.facebook_url'),
            'article:tag' => '',
            'article:section' => ''
        ];

        if ($entity->displayMetaDates) {
            $attributes['article:published_time'] = ($entity->published !== null) ? $entity->published->format('c') : null;
            $attributes['article:modified_time'] = $entity->modified->format('c');
        }

        $out = '';
        foreach ($attributes as $property => $content) {
            $out .= $this->_render(self::ATTR_PROP, $property, $content);
        }

        return $out;
    }
318903
public function getDefault(EntityContract $entity)
    {
        $method = $this->default;

        return $method !== null ? $method($entity, $this) : (object) [];
    }
275327
public function geocode(Entity $entity) {
		$addressfields = (array)$this->_config['address'];

		$addressData = [];
		$dirty = false;
		foreach ($addressfields as $field) {
			$fieldData = $entity->get($field);
			if ($fieldData) {
				$addressData[] = $fieldData;
			}
			if ($entity->isDirty($field)) {
				$dirty = true;
			}
		}
		if (!$dirty) {
			if ($this->_config['allowEmpty'] || $entity->lat && $entity->lng) {
				return $entity;
			}
			if ($entity instanceof Entity) {
				$this->invalidate($entity);
			}
			return null;
		}

		$result = $this->_geocode($entity, $addressData);
		if (is_array($result)) {
			throw new RuntimeException('Array type not expected');
		}

		return $result;
	}
254539
public function getEntityChangeSet($entity)
    {
        $oid = spl_object_hash($entity);

        if (isset($this->entityChangeSets[$oid])) {
            return $this->entityChangeSets[$oid];
        }

        return array();
    }
991110
public function getAttributes($entity)
    {
        if ($entity->has($this->idField)) {
            $hidden = array_merge($entity->getHidden(), [$this->idField]);
            $entity->setHidden($hidden);
        }

        $attributes = $entity->toArray();

        // remove associated data so it won't appear inside jsonapi `attributes`
        foreach ($this->_repository->associations() as $association) {
            $propertyName = $association->getProperty();

            if ($association->type() === Association::MANY_TO_ONE) {
                $foreignKey = $association->getForeignKey();
                unset($attributes[$foreignKey]);
            }

            unset($attributes[$propertyName]);
        }

        // dasherize attribute keys (like `created_by`) if need be
        if ($this->_view->viewVars['_inflect'] === 'dasherize') {
            foreach ($attributes as $key => $value) {
                $dasherizedKey = Inflector::dasherize($key);

                if (!array_key_exists($dasherizedKey, $attributes)) {
                    $attributes[$dasherizedKey] = $value;
                    unset($attributes[$key]);
                }
            }
        }

        return $attributes;
    }
546477
public function load(Entity $entity)
    {
        /** @var \Slick\Orm\Sql\Select $sql */
        $sql = call_user_func_array(
            array($this->getRelatedEntity(), 'find'),
            []
        );
        $pmk = $this->getEntity()->getPrimaryKey();
        $table = Entity\Manager::getInstance()->get($this->getRelatedEntity())
            ->getEntity()->getTableName();
        $sql->where(
            [
                "{$table}.{$this->getForeignKey()} = :id" => [
                    ':id' => $this->getEntity()->$pmk
                ]
            ]
        );
        return $sql->first();
    }
1298058
public function getEntityClassName($entity)
    {
        if (array_key_exists($entity, $this->entityMap)) {
            return $this->entityMap;
        }

        return $this->rootEntityNamespace . $entity;
    }
266500
public function delete($entity) {
		if (is_null($entity))
			return;
		
		//connect to database
		$this->mapper->connect();
		
		//begin transaction
		$this->mapper->beginTransaction();
		
		//get primary key
		$pk = $this->getPropertyValue($this->entityProfile, $entity, $this->entityProfile->getPrimaryKey());

		foreach ($this->entityProfile->getReferences() as $assoc)
			$this->entityProfile->getAssociation($assoc)->delete($this->mapper, $pk);
		
		//build fluent query
		$query = $this->mapper->newQuery()
		->deleteFrom($this->entityProfile->getEntityTable())
		->where(Column::__callstatic($this->entityProfile->getPrimaryKey(true))->eq($pk));
		
		//run query
		$result = $query->exec();
		
		//commit
		$this->mapper->commit();
		return $result;
	}
1153509
public function getRelativePath($entity, $field)
    {
        if (is_object($entity)) {
            $entity = get_class($entity);
        }
        $entity = strtolower(Str::classname($entity));

        return $entity . '/' . $field;
    }