本文整理汇总了PHP中Cake\ORM\Association::property方法的典型用法代码示例。如果您正苦于以下问题:PHP Association::property方法的具体用法?PHP Association::property怎么用?PHP Association::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\ORM\Association
的用法示例。
在下文中一共展示了Association::property方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: property
/**
* Sets the property name that should be filled with data from the target table
* in the source table record.
* If no arguments are passed, currently configured type is returned.
*
* @param string|null $name The name of the property. Pass null to read the current value.
* @return string
*/
public function property($name = null)
{
if ($name !== null) {
return parent::property($name);
}
if ($name === null && !$this->_propertyName) {
list(, $name) = pluginSplit($this->_name);
$this->_propertyName = Inflector::underscore(Inflector::singularize($name));
}
return $this->_propertyName;
}
示例2: _save
/**
* Helper method for saving an association's data.
*
* @param Association $association The association object to save with.
* @param Entity $entity The entity to save
* @param array $nested Options for deeper associations
* @param array $options Original options
* @return bool Success
*/
protected function _save($association, $entity, $nested, $options)
{
if (!$entity->dirty($association->property())) {
return true;
}
if (!empty($nested)) {
$options = (array) $nested + $options;
}
return (bool) $association->save($entity, $options);
}
示例3: addToJoinsMap
/**
* Registers a table alias, typically loaded as a join in a query, as belonging to
* an association. This helps hydrators know what to do with the columns coming
* from such joined table.
*
* @param string $alias The table alias as it appears in the query.
* @param \Cake\ORM\Association $assoc The association object the alias represents;
* will be normalized
* @param bool $asMatching Whether or not this join results should be treated as a
* 'matching' association.
* @param string $targetProperty The property name where the results of the join should be nested at.
* If not passed, the default property for the association will be used.
* @return void
*/
public function addToJoinsMap($alias, Association $assoc, $asMatching = false, $targetProperty = null)
{
$this->_joinsMap[$alias] = new EagerLoadable($alias, ['aliasPath' => $alias, 'instance' => $assoc, 'canBeJoined' => true, 'forMatching' => $asMatching, 'targetProperty' => $targetProperty ?: $assoc->property()]);
}