Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
1600889f
Commit
1600889f
authored
Oct 13, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added isAttributeActive to Model
consistent api for safe and required
parent
a1e6c16e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
Model.php
framework/yii/base/Model.php
+12
-0
No files found.
framework/yii/base/Model.php
View file @
1600889f
...
@@ -422,6 +422,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
...
@@ -422,6 +422,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
* Returns a value indicating whether the attribute is safe for massive assignments.
* Returns a value indicating whether the attribute is safe for massive assignments.
* @param string $attribute attribute name
* @param string $attribute attribute name
* @return boolean whether the attribute is safe for massive assignments
* @return boolean whether the attribute is safe for massive assignments
* @see safeAttributes()
*/
*/
public
function
isAttributeSafe
(
$attribute
)
public
function
isAttributeSafe
(
$attribute
)
{
{
...
@@ -429,6 +430,17 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
...
@@ -429,6 +430,17 @@ class Model extends Component implements IteratorAggregate, ArrayAccess
}
}
/**
/**
* Returns a value indicating whether the attribute is active in the current scenario.
* @param string $attribute attribute name
* @return boolean whether the attribute is active in the current scenario
* @see activeAttributes()
*/
public
function
isAttributeActive
(
$attribute
)
{
return
in_array
(
$attribute
,
$this
->
activeAttributes
(),
true
);
}
/**
* Returns the text label for the specified attribute.
* Returns the text label for the specified attribute.
* @param string $attribute the attribute name
* @param string $attribute the attribute name
* @return string the attribute label
* @return string the attribute label
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment