當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PropelObjectCollection::getModel方法代碼示例

本文整理匯總了PHP中PropelObjectCollection::getModel方法的典型用法代碼示例。如果您正苦於以下問題:PHP PropelObjectCollection::getModel方法的具體用法?PHP PropelObjectCollection::getModel怎麽用?PHP PropelObjectCollection::getModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PropelObjectCollection的用法示例。


在下文中一共展示了PropelObjectCollection::getModel方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor.
  *
  * @param \PropelObjectCollection $entries
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
  * @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
  * @param array $loadedSecurityIdentities
  * @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
  * @param bool $inherited
  */
 public function __construct(\PropelObjectCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
 {
     if ($entries->getModel() !== $this->model) {
         throw new AclException(sprintf('The given collection does not contain models of class "%s" but of class "%s".', $this->model, $entries->getModel()));
     }
     foreach ($entries as $eachEntry) {
         if (null === $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             $this->classAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             if (empty($this->classFieldAces[$eachEntry->getFieldName()])) {
                 $this->classFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->classFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
         if (null === $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             $this->objectAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             if (empty($this->objectFieldAces[$eachEntry->getFieldName()])) {
                 $this->objectFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->objectFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
     }
     $this->objectIdentity = $objectIdentity;
     $this->permissionGrantingStrategy = $permissionGrantingStrategy;
     $this->parentAcl = $parentAcl;
     $this->inherited = $inherited;
     $this->loadedSecurityIdentities = $loadedSecurityIdentities;
     $this->fields = array_unique($this->fields);
 }
開發者ID:angelk,項目名稱:PropelBundle,代碼行數:44,代碼來源:Acl.php

示例2: __construct

  /**
   * Form constructor.
   *
   * Available options:
   * - embedded_form_class: The class name of the forms to embed. Uses the model name by default.
   *                  (a form based on a collection of Book objects embeds BookForm objects)
   * - item_pattern:  The pattern used to name each embedded form. Defaults to '%index%'.
   * - add_delete:    Whether to add a delete widget for each object. Defaults to true.
   * - delete_name:   Name of the delete widget. Defaults to 'delete'.
   * - delete_widget: Optional delete widget object. If left null, uses a sfWidgetFormDelete instance.
   * - alert_text:    The text of the Javascript alert to show
   * - hide_parent:   Whether to hide the parent form when clicking the checkbox
   * - parent_level:  The number of times parentNode must be called to reach the parent to hide.
   *                  Recommended values: 6 for embedded form, 7 for merged form
   * - remove_fields: The list of fields to remove from the embedded object forms
   *
   * @param PropelCollection $collection A collection of Propel objects
   *                                     used to initialize default values
   * @param array            $options    An array of options
   * @param string           $CSRFSecret A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret)
   *
   * @see sfForm
   */
  public function __construct($collection = null, $options = array(), $CSRFSecret = null)
  {
    $options = array_merge(array(
      'item_pattern'  => '%index%',
      'add_delete'    => false,
      'delete_name'   => 'delete',
      'delete_widget' => null,
      'remove_fields' => array(),
    ), $options);

    if (!$collection)
    {
      $this->model = $options['model'];
      $collection = new PropelObjectCollection();
      $collection->setModel($this->model);
      $this->collection = $collection;
    }
    else
    {
      if (!$collection instanceof PropelObjectCollection)
      {
        throw new sfException(sprintf('The "%s" form only accepts a PropelObjectCollection object.', get_class($this)));
      }
      $this->collection = $collection;
      $this->model = $collection->getModel();
    }

    $this->isEmpty = $this->getCollection()->isEmpty();

    parent::__construct(array(), $options, $CSRFSecret);
  }
開發者ID:nurhidayatullah,項目名稱:inventory,代碼行數:54,代碼來源:sfFormPropelCollection.class.php


注:本文中的PropelObjectCollection::getModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。