PHP code example of fyre / entity

1. Go to this page and download the library: Download fyre/entity library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fyre / entity example snippets


use Fyre\Entity\EntityLocator;

$entityLocator = new EntityLocator($inflector);

$container->singleton(EntityLocator::class);

$entityLocator->addNamespace($namespace);

$entityLocator->clear();

$className = $entityLocator->find($alias);

$alias = $entityLocator->findAlias($className);

$defaultEntityClass = $entityLocator->getDefaultEntityClass();

$namespaces = $entityLocator->getNamespaces();

$hasNamespace = $entityLocator->hasNamespace($namespace);

$entityLocator->map($alias, $className);

$entityLocator->removeNamespace($namespace);

$entityLocator->setDefaultEntityClass($defaultEntityClass);

use Fyre\Entity\Entity;

$entity = new Entity($data, $options);

$entity->clean();

$entity->clear($fields);

$entity->clearTemporaryFields();

$values = $entity->extract($fields);

$values = $entity->extractDirty($fields);

$values = $entity->extractDirty();

$values = $entity->extractOriginal($fields);

$values = $entity->extractOriginalChanged($fields);

$entity->fill($data, $options);

$entity->fillInvalid($data, $overwrite);

$value = $entity->get($field);

$value = $entity->$field;
$value = $entity[$field];

$accessible = $entity->getAccessible();

$dirty = $entity->getDirty();

$errors = $entity->getError($field);

$errors = $entity->getErrors();

$hidden = $entity->getHidden();

$value = $entity->getInvalid($field);

$invalid = $entity->getInvalid();

$value = $entity->getOriginal($field, $fallback);

$original = $entity->getOriginal();

$originalFields = $entity->getOriginalFields();

$originalValues = $entity->getOriginalValues();

$source = $entity->getSource();

$temporaryFields = $entity->getTemporaryFields();

$virtual = $entity->getVirtual();

$visible = $entity->getVisible();

$has = $entity->has($field);

$isset = isset($entity->$field);
$isset = isset($entity[$field]);

$hasOriginal = $entity->hasOriginal($field);

$hasValue = $entity->hasValue($field);

$hasErrors = $entity->hasErrors();

$isAccessible = $entity->isAccessible($field);

$isDirty = $entity->isDirty($field);

$isDirty = $entity->isDirty();

$isEmpty = $entity->isEmpty();

$isNew = $entity->isNew();

$isOriginalField = $entity->isOriginalField($field);

$entity->set($field, $value, $options);

$entity->$field = $value;
$entity[$field] = $value;

$entity->setAccess($field, $accessible);

$entity->setDirty($field, $dirty);

$entity->setError($field, $error, $ovewrite);

$entity->setErrors($errors, $overwrite);

$entity->setHidden($fields, $merge);

$entity->setInvalid($field, $value, $overwrite);

$entity->setNew($new);

$entity->setOriginalFields($fields, $merge);

$entity->setSource($source);

$entity->setTemporaryFields($fields, $overwrite);

$entity->setVirtual($fields, $merge);

$array = $entity->toArray();

$json = $entity->toJson();

$json = (string) $entity;

$entity->unset($field);

unset($entity->$field);
unset($entity[$field]);